File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,7 +11,6 @@ import { writeStderrLine, writeStdoutLine } from "./utils/stdioHelpers";
1111import { getPackageJson } from "./utils/package" ;
1212import { CLI_VERSION } from "./generated/git-commit" ;
1313
14- configureWindowsShell ( ) ;
1514void main ( ) ;
1615
1716async function main ( ) : Promise < void > {
@@ -24,6 +23,11 @@ async function main(): Promise<void> {
2423 process . exit ( 0 ) ;
2524 }
2625
26+ // Configure Windows shell AFTER --version/--help handling.
27+ // On Windows without Git Bash, setShellIfWindows() throws and calls process.exit(1).
28+ // If called before argument parsing, --help and --version would fail on those machines.
29+ configureWindowsShell ( ) ;
30+
2731 let initialPrompt = parsed . prompt ;
2832 let resumeSessionId = parsed . resume ;
2933 const projectRoot = process . cwd ( ) ;
@@ -95,6 +99,12 @@ async function main(): Promise<void> {
9599 startApp ( ) ;
96100}
97101
102+ /**
103+ * Configure shell environment for Windows.
104+ * Sets NoDefaultCurrentDirectoryInExePath and resolves Git Bash path.
105+ * Must be called after --version/--help handling to avoid blocking those
106+ * commands on Windows machines without Git Bash installed.
107+ */
98108function configureWindowsShell ( ) : void {
99109 process . env . NoDefaultCurrentDirectoryInExePath = "1" ;
100110 try {
You can’t perform that action at this time.
0 commit comments