@@ -76,10 +76,10 @@ describe('Session', () => {
7676 expect ( session . isReady ( ) ) . toBe ( true ) ;
7777 } ) ;
7878
79- it ( 'should fall back to /tmp when cwd does not exist (issue #288)' , async ( ) => {
79+ it ( 'should fall back to home directory when cwd does not exist (issue #288)' , async ( ) => {
8080 // Session cwd only affects shell startup directory - it's not critical.
81- // If cwd doesn't exist, we fall back to /tmp since individual commands
82- // can specify their own cwd anyway.
81+ // If cwd doesn't exist, we fall back to the home directory since individual
82+ // commands can specify their own cwd anyway.
8383 session = new Session ( {
8484 id : 'test-session-nonexistent-cwd' ,
8585 cwd : '/nonexistent/path/that/does/not/exist'
@@ -92,12 +92,12 @@ describe('Session', () => {
9292 // Verify we can execute commands
9393 const result = await session . exec ( 'pwd' ) ;
9494 expect ( result . exitCode ) . toBe ( 0 ) ;
95- // The shell should have started in /tmp since the requested cwd doesn't exist
96- // On macOS, /tmp is a symlink to /private/tmp
97- expect ( result . stdout . trim ( ) ) . toMatch ( / ^ ( \/ t m p | \/ p r i v a t e \/ t m p ) $ / ) ;
95+ // The shell should have started in the home directory since the requested cwd doesn't exist
96+ const homeDir = process . env . HOME || '/root' ;
97+ expect ( result . stdout . trim ( ) ) . toBe ( homeDir ) ;
9898 } ) ;
9999
100- it ( 'should fall back to /tmp when workspace is deleted before session creation (issue #288)' , async ( ) => {
100+ it ( 'should fall back to home directory when workspace is deleted before session creation (issue #288)' , async ( ) => {
101101 // Simulate the exact scenario from issue #288
102102 // Create a workspace, then delete it, then try to create a session with it
103103 const workspaceDir = join ( testDir , 'workspace' ) ;
@@ -112,7 +112,7 @@ describe('Session', () => {
112112 cwd : workspaceDir
113113 } ) ;
114114
115- // Should succeed - falls back to /tmp
115+ // Should succeed - falls back to home directory
116116 await session . initialize ( ) ;
117117
118118 expect ( session . isReady ( ) ) . toBe ( true ) ;
0 commit comments