Skip to content

Add Windows GUI executable subsystem support - #276

Open
ctate wants to merge 4 commits into
mainfrom
ctate/no-way-to-pass-a-linker-flag-e-g-mwindows-for-th-c5b126d0
Open

Add Windows GUI executable subsystem support#276
ctate wants to merge 4 commits into
mainfrom
ctate/no-way-to-pass-a-linker-flag-e-g-mwindows-for-th-c5b126d0

Conversation

@ctate

@ctate ctate commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds first-class Windows executable subsystem selection through the CLI and compiler API. Windows executable builds and scriptc run accept --subsystem=console or --subsystem=windows; console remains the default, while windows links a GUI PE executable without changing scriptc’s ordinary main entry point. Invalid combinations are rejected for non-executable output and non-Windows targets.

The linker, executable caches, local artifact identities, and routed cache keys now preserve separate console and GUI variants. Windows-safe artifact and metadata replacement also allows a cached executable or generated artifact at the same path to be refreshed when the selected subsystem changes. The supported behavior is documented for the CLI and Windows cross-compilation workflow, with Windows regression coverage included.

Closes #259

ctate and others added 4 commits August 31, 2026 14:59
Co-authored-by: mmamedel <23098414+mmamedel@users.noreply.github.com>
Co-authored-by: mmamedel <23098414+mmamedel@users.noreply.github.com>
Co-authored-by: mmamedel <23098414+mmamedel@users.noreply.github.com>
Co-authored-by: mmamedel <23098414+mmamedel@users.noreply.github.com>
@vercel

vercel Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
scriptc Ready Ready Preview, v0 Aug 31, 2026 7:59pm

Comment on lines +3848 to +3853
await rename(tmp, stampPath).catch(async () => {
// POSIX rename replaces a previous same-output stamp, but Windows does
// not. A console build followed by a GUI build deliberately has a new
// identity at the same output path; failing to replace this metadata
// suppresses onArtifactReady, leaving the GUI executable unavailable to
// the bootstrap's routed cache on its next invocation.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
await rename(tmp, stampPath).catch(async () => {
// POSIX rename replaces a previous same-output stamp, but Windows does
// not. A console build followed by a GUI build deliberately has a new
// identity at the same output path; failing to replace this metadata
// suppresses onArtifactReady, leaving the GUI executable unavailable to
// the bootstrap's routed cache on its next invocation.
await rename(tmp, stampPath).catch(async (error) => {
// POSIX rename replaces a previous same-output stamp, but Windows does
// not. A console build followed by a GUI build deliberately has a new
// identity at the same output path; failing to replace this metadata
// suppresses onArtifactReady, leaving the GUI executable unavailable to
// the bootstrap's routed cache on its next invocation. On POSIX a rename
// failure is a genuine error (EACCES, ENOSPC, a concurrently removed
// directory), so surface it rather than deleting a valid prior stamp.
if (process.platform !== "win32") throw error;

publishLocalArtifactStamp's rename fallback runs the rm+retry on all platforms and swallows the original error, instead of only running on Windows and rethrowing genuine POSIX rename failures.

Fix on Vercel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No way to pass a linker flag (e.g. -mwindows for the Windows GUI subsystem)

1 participant