fix(windows): use os.homedir() fallback so dmux starts on Windows#86
Open
pushp1997 wants to merge 1 commit intostandardagents:mainfrom
Open
fix(windows): use os.homedir() fallback so dmux starts on Windows#86pushp1997 wants to merge 1 commit intostandardagents:mainfrom
pushp1997 wants to merge 1 commit intostandardagents:mainfrom
Conversation
On Windows, process.env.HOME is undefined (Windows uses USERPROFILE). path.join(undefined, ...) throws TypeError, which is silently swallowed by the .catch(() => process.exit(1)) wrapping init(), causing dmux to bounce back to the prompt with no diagnostic output. Matches the existing process.env.HOME || os.homedir() pattern used elsewhere in the codebase (utils/onboarding.ts, etc.). Fixes standardagents#85
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.
Summary
Fixes #85.
On Windows,
process.env.HOMEisundefined(Windows usesUSERPROFILE). Atsrc/index.ts:1148:The
!non-null assertion lies to the type checker. At runtime,path.join(undefined, ...)throwsTypeError: The "path" argument must be of type string. Received undefined. The exception is swallowed by.catch(() => process.exit(1))at the bottom ofinit(), so Windows users see dmux silently exit with code 1 and never get pastmigrateOldConfig().This PR replaces
process.env.HOME!withprocess.env.HOME || os.homedir(), matching the safe pattern already used elsewhere in the codebase (src/utils/onboarding.ts,src/utils/openRouterApiKeySetup.ts,src/utils/tmuxConfigOnboarding.ts).Changes
src/index.ts:import os from 'os';process.env.HOME!withprocess.env.HOME || os.homedir()inmigrateOldConfig()Note on
src/server/embedded-assets.tsThe same buggy line exists at
src/server/embedded-assets.ts:1374inside a template literal. That file has aDO NOT EDIT MANUALLY - Generated by scripts/embed-assets.jsheader, so I left it alone in this PR. Whatever generator produces it should pick up this change on the next regeneration. Happy to include a follow-up if you'd like it patched manually in the meantime.Test plan
dmux.config.jsonand proceeds pastmigrateOldConfig()(exit 0 in non-TTY harness, ink UI launches in real terminals).process.env.HOMEis set, so the||short-circuits beforeos.homedir()is even called. (No CI run yet from my fork.)