File tree Expand file tree Collapse file tree 4 files changed +8
-21
lines changed
Expand file tree Collapse file tree 4 files changed +8
-21
lines changed Original file line number Diff line number Diff line change @@ -50,7 +50,9 @@ export function syncShellEnvironment(
5050 }
5151
5252 const launchctlPath =
53- platform === "darwin" ? ( options . readLaunchctlPath ?? readPathFromLaunchctl ) ( ) : undefined ;
53+ platform === "darwin" && ! shellEnvironment . PATH
54+ ? ( options . readLaunchctlPath ?? readPathFromLaunchctl ) ( )
55+ : undefined ;
5456 const mergedPath = mergePathEntries ( shellEnvironment . PATH ?? launchctlPath , env . PATH , platform ) ;
5557 if ( mergedPath ) {
5658 env . PATH = mergedPath ;
@@ -71,7 +73,7 @@ export function syncShellEnvironment(
7173 env [ name ] = shellEnvironment [ name ] ;
7274 }
7375 }
74- } catch {
75- logWarning ( "Failed to synchronize the desktop shell environment." ) ;
76+ } catch ( error ) {
77+ logWarning ( "Failed to synchronize the desktop shell environment." , error ) ;
7678 }
7779}
Original file line number Diff line number Diff line change @@ -43,7 +43,9 @@ export function fixPath(
4343 }
4444
4545 const launchctlPath =
46- platform === "darwin" ? ( options . readLaunchctlPath ?? readPathFromLaunchctl ) ( ) : undefined ;
46+ platform === "darwin" && ! shellPath
47+ ? ( options . readLaunchctlPath ?? readPathFromLaunchctl ) ( )
48+ : undefined ;
4749 const mergedPath = mergePathEntries ( shellPath ?? launchctlPath , env . PATH , platform ) ;
4850 if ( mergedPath ) {
4951 env . PATH = mergedPath ;
Original file line number Diff line number Diff line change 77 readEnvironmentFromLoginShell ,
88 readPathFromLaunchctl ,
99 readPathFromLoginShell ,
10- resolveLoginShell ,
1110} from "./shell" ;
1211
1312describe ( "extractPathFromShellOutput" , ( ) => {
@@ -176,14 +175,6 @@ describe("listLoginShellCandidates", () => {
176175 } ) ;
177176} ) ;
178177
179- describe ( "resolveLoginShell" , ( ) => {
180- it ( "returns the first available login shell candidate" , ( ) => {
181- expect ( resolveLoginShell ( "darwin" , undefined , "/opt/homebrew/bin/fish" ) ) . toBe (
182- "/opt/homebrew/bin/fish" ,
183- ) ;
184- } ) ;
185- } ) ;
186-
187178describe ( "mergePathEntries" , ( ) => {
188179 it ( "prefers login-shell PATH entries and keeps inherited extras" , ( ) => {
189180 expect (
Original file line number Diff line number Diff line change @@ -45,14 +45,6 @@ export function listLoginShellCandidates(
4545 return candidates ;
4646}
4747
48- export function resolveLoginShell (
49- platform : NodeJS . Platform ,
50- shell : string | undefined ,
51- userShell = readUserLoginShell ( ) ,
52- ) : string | undefined {
53- return listLoginShellCandidates ( platform , shell , userShell ) [ 0 ] ;
54- }
55-
5648export function extractPathFromShellOutput ( output : string ) : string | null {
5749 const startIndex = output . indexOf ( PATH_CAPTURE_START ) ;
5850 if ( startIndex === - 1 ) return null ;
You can’t perform that action at this time.
0 commit comments