Repository navigation
fix(desktop): disable RunAsNode fuse on Windows and Linux builds - #1801
Merged
Merged
Conversation
A packaged Mcode launched from a terminal inside an Electron app inherits ELECTRON_RUN_AS_NODE=1, runs main as plain Node, and crashes in getServerPortBand. Disabling the RunAsNode fuse makes the GUI binary ignore the variable. Node-mode work already uses the renamed mcode-server copy, which is built before the fuse flip. macOS keeps the fuse because unsigned builds run the GUI binary as their PTY host. Refs #1799
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The packaged app on Windows and Linux now ignores
ELECTRON_RUN_AS_NODE. Before this change, launchingMcode.exefrom a terminal inside VS Code, Mcode, or another Electron app crashed at startup. These terminals exportELECTRON_RUN_AS_NODE=1.The fix sets Electron's
RunAsNodefuse to off on the GUI binary inafter-pack.mjs. macOS is unchanged. This is part of #1799, which stays open for macOS.Why
PR #1798 fixed this crash for
bun run prod:desktop. A packaged app has no launcher of ours that could remove the variable, so the fix has to be in the binary. Electron recommends turning this fuse off for shipped apps anyway.The change is safe on Windows and Linux because nothing runs the GUI binary in Node mode there:
mcode-serverbinary for Node-mode work.child.ts:71-72refuses to start without it.after-pack.mjsstep 1).mcode-serveron these platforms (terminal-release-evidence.mjs:118,127).macOS keeps the fuse on because unsigned builds use the GUI binary as the PTY host (
terminal-release-evidence.mjs:136-138,smoke-test.mjs:79-90). Changing that needs the macOS smoke test reworked, and macOS can't be tested from Windows.Review Notes
Evidence. I couldn't build a full local package on Windows, because the
node-ptyrebuild needs Visual Studio Build Tools, which this machine lacks. Instead I tested the fuse itself. I copied the repo's Electron 35.7.5 binary, ran the built app withELECTRON_RUN_AS_NODE=1set, and used a tempMCODE_DATA_DIR.With the fuse enabled (the default, fuse byte 49), the app crashed:
With
RunAsNodeturned off byflipFuses(fuse byte 48), the same launch started normally:Known gaps:
package-canaryjob builds and smoke-tests Linux with the fuse change. Windows packaging runs only in the full package job, so the first real packaged Windows build will be the next nightly.Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.