@@ -100,11 +100,21 @@ function runShellEnvironment(input: {
100100}
101101
102102describe ( "DesktopShellEnvironment" , ( ) => {
103+ it ( "uses the OS account shell when a packaged GUI launch omits SHELL" , ( ) => {
104+ assert . deepEqual (
105+ DesktopShellEnvironment . resolveDesktopLoginShellCandidates (
106+ { env : { PATH : "/usr/bin" } , platform : "darwin" } ,
107+ "/opt/homebrew/bin/fish" ,
108+ ) ,
109+ [ "/opt/homebrew/bin/fish" , "/bin/zsh" ] ,
110+ ) ;
111+ } ) ;
112+
103113 it . effect ( "hydrates PATH and missing SSH_AUTH_SOCK from the login shell on macOS" , ( ) =>
104114 Effect . gen ( function * ( ) {
105115 const env : NodeJS . ProcessEnv = {
106116 SHELL : "/bin/zsh" ,
107- PATH : "/Users/test/.local/bin:/ usr/bin" ,
117+ PATH : "/usr/bin" ,
108118 } ;
109119 const commands : ChildProcess . Command [ ] = [ ] ;
110120
@@ -114,7 +124,7 @@ describe("DesktopShellEnvironment", () => {
114124 handler : ( command ) => {
115125 commands . push ( command ) ;
116126 return envOutput ( {
117- PATH : "/opt/homebrew/bin:/usr/bin" ,
127+ PATH : "/Users/test/.local/bin:/ opt/homebrew/bin:/usr/bin" ,
118128 SSH_AUTH_SOCK : "/tmp/secretive.sock" ,
119129 HOMEBREW_PREFIX : "/opt/homebrew" ,
120130 } ) ;
@@ -123,7 +133,7 @@ describe("DesktopShellEnvironment", () => {
123133
124134 assert . equal ( commands . length , 1 ) ;
125135 assert . equal ( commands [ 0 ] ?. _tag === "StandardCommand" ? commands [ 0 ] . command : "" , "/bin/zsh" ) ;
126- assert . equal ( env . PATH , "/opt/homebrew/ bin:/usr/ bin:/Users/test/.local /bin" ) ;
136+ assert . equal ( env . PATH , "/Users/test/.local/ bin:/opt/homebrew/ bin:/usr /bin" ) ;
127137 assert . equal ( env . SSH_AUTH_SOCK , "/tmp/secretive.sock" ) ;
128138 assert . equal ( env . HOMEBREW_PREFIX , "/opt/homebrew" ) ;
129139 } ) ,
@@ -331,13 +341,13 @@ describe("DesktopShellEnvironment", () => {
331341 const errors = messages
332342 . flatMap ( ( message ) => ( Array . isArray ( message ) ? message : [ message ] ) )
333343 . filter ( isDesktopShellEnvironmentCommandError ) ;
334- assert . lengthOf ( errors , 1 ) ;
335- assert . equal ( errors [ 0 ] ?. probe , "login-shell" ) ;
336- assert . equal ( errors [ 0 ] ?. executable , "bash " ) ;
337- assert . equal ( errors [ 0 ] ?. argumentCount , 2 ) ;
338- assert . notProperty ( errors [ 0 ] ?? { } , "args" ) ;
339- assert . equal ( errors [ 0 ] ?. cause , cause ) ;
340- assert . notInclude ( errors [ 0 ] ?. message ?? "" , cause . message ) ;
344+ const bashErrors = errors . filter ( ( error ) => error . executable === "bash" ) ;
345+ assert . lengthOf ( bashErrors , 1 ) ;
346+ assert . equal ( bashErrors [ 0 ] ?. probe , "login-shell " ) ;
347+ assert . equal ( bashErrors [ 0 ] ?. argumentCount , 2 ) ;
348+ assert . notProperty ( bashErrors [ 0 ] ?? { } , "args" ) ;
349+ assert . equal ( bashErrors [ 0 ] ?. cause , cause ) ;
350+ assert . notInclude ( bashErrors [ 0 ] ?. message ?? "" , cause . message ) ;
341351 } ) ,
342352 ) ,
343353 Effect . provide ( Logger . layer ( [ logger ] , { mergeWithExisting : false } ) ) ,
0 commit comments