File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1076,5 +1076,9 @@ describe("desktop shell environment updates", () => {
10761076 } ;
10771077 applyShellEnvironment ( env , message . environment ) ;
10781078 expect ( env ) . toEqual ( { PATH : "C:\\fresh" , SSH_AUTH_SOCK : "/current.sock" , UNRELATED : "keep" } ) ;
1079+ env . Path = "C:\\stale" ;
1080+ env . path = "C:\\other" ;
1081+ applyShellEnvironment ( env , { PATH : null , SSH_AUTH_SOCK : null } ) ;
1082+ expect ( env ) . toEqual ( { UNRELATED : "keep" } ) ;
10791083 } ) ;
10801084} ) ;
Original file line number Diff line number Diff line change @@ -909,13 +909,13 @@ function resolveKnownWindowsCliDirs(env: NodeJS.ProcessEnv): ReadonlyArray<strin
909909}
910910
911911/** Keep one PATH spelling in copied Windows environment records. */
912- export function setWindowsPath ( env : NodeJS . ProcessEnv , value : string ) : void {
912+ export function setWindowsPath ( env : NodeJS . ProcessEnv , value : string | null ) : void {
913913 for ( const key of Object . keys ( env ) ) {
914914 if ( key . toUpperCase ( ) === "PATH" ) {
915915 delete env [ key ] ;
916916 }
917917 }
918- env . PATH = value ;
918+ if ( value !== null ) env . PATH = value ;
919919}
920920
921921function mergeWindowsEnv (
@@ -969,8 +969,8 @@ export const resolveWindowsEnvironment = Effect.fn("shell.resolveWindowsEnvironm
969969
970970export function applyShellEnvironment ( env : NodeJS . ProcessEnv , patch : ShellEnvironmentPatch ) : void {
971971 for ( const [ key , value ] of Object . entries ( patch ) ) {
972- if ( value === null ) delete env [ key ] ;
973- else if ( key === "PATH" ) setWindowsPath ( env , value ) ;
972+ if ( key === "PATH" ) setWindowsPath ( env , value ) ;
973+ else if ( value === null ) delete env [ key ] ;
974974 else env [ key ] = value ;
975975 }
976976}
You can’t perform that action at this time.
0 commit comments