@@ -455,7 +455,9 @@ function ensurePowerShellProfileGuard(shimDirectory) {
455455}
456456
457457function ensureWindowsShellShimGuards ( ) {
458- if ( ! shouldInstallWindowsBatchShimGuard ( ) ) return ;
458+ const shouldInstallBatchGuard = shouldInstallWindowsBatchShimGuard ( ) ;
459+ const shouldInstallProfileGuard = shouldInstallPowerShellProfileGuard ( ) ;
460+ if ( ! shouldInstallBatchGuard && ! shouldInstallProfileGuard ) return ;
459461 const shimDirectory = resolveWindowsShimDirectoryFromPath ( ) ;
460462 if ( ! shimDirectory ) return ;
461463
@@ -464,23 +466,31 @@ function ensureWindowsShellShimGuards() {
464466
465467 const overwriteCustomShim =
466468 ( process . env . CODEX_MULTI_AUTH_OVERWRITE_CUSTOM_BATCH_SHIM ?? "0" ) . trim ( ) === "1" ;
467- const installedBatch = ensureWindowsShellShim (
468- join ( shimDirectory , "codex.bat" ) ,
469- buildWindowsBatchShimContent ( ) ,
470- { overwriteCustomShim } ,
471- ) ;
472- const installedCmd = ensureWindowsShellShim (
473- join ( shimDirectory , "codex.cmd" ) ,
474- buildWindowsCmdShimContent ( ) ,
475- { overwriteCustomShim } ,
476- ) ;
477- const installedPs1 = ensureWindowsShellShim (
478- join ( shimDirectory , "codex.ps1" ) ,
479- buildWindowsPowerShellShimContent ( ) ,
480- { overwriteCustomShim } ,
481- ) ;
469+ const installedBatch = shouldInstallBatchGuard
470+ ? ensureWindowsShellShim (
471+ join ( shimDirectory , "codex.bat" ) ,
472+ buildWindowsBatchShimContent ( ) ,
473+ { overwriteCustomShim } ,
474+ )
475+ : false ;
476+ const installedCmd = shouldInstallBatchGuard
477+ ? ensureWindowsShellShim (
478+ join ( shimDirectory , "codex.cmd" ) ,
479+ buildWindowsCmdShimContent ( ) ,
480+ { overwriteCustomShim } ,
481+ )
482+ : false ;
483+ const installedPs1 = shouldInstallBatchGuard
484+ ? ensureWindowsShellShim (
485+ join ( shimDirectory , "codex.ps1" ) ,
486+ buildWindowsPowerShellShimContent ( ) ,
487+ { overwriteCustomShim } ,
488+ )
489+ : false ;
482490 const installedAny = installedBatch || installedCmd || installedPs1 ;
483- const installedProfileGuard = ensurePowerShellProfileGuard ( shimDirectory ) ;
491+ const installedProfileGuard = shouldInstallProfileGuard
492+ ? ensurePowerShellProfileGuard ( shimDirectory )
493+ : false ;
484494 if ( installedAny || installedProfileGuard ) {
485495 console . error (
486496 "codex-multi-auth: installed Windows shell guards to keep multi-auth routing after codex npm updates." ,
0 commit comments