@@ -69,6 +69,13 @@ impl OpenShell for TestOpenShell {
6969 Err ( Status :: unimplemented ( "not used by this test server" ) )
7070 }
7171
72+ async fn finalize_main_process_exit (
73+ & self ,
74+ _request : tonic:: Request < openshell_core:: proto:: FinalizeMainProcessExitRequest > ,
75+ ) -> Result < Response < openshell_core:: proto:: FinalizeMainProcessExitResponse > , Status > {
76+ Err ( Status :: unimplemented ( "not used by this test server" ) )
77+ }
78+
7279 async fn get_current_user (
7380 & self ,
7481 _request : tonic:: Request < openshell_core:: proto:: GetCurrentUserRequest > ,
@@ -1349,6 +1356,35 @@ async fn sandbox_create_persists_exact_trailing_argv_as_main_process() {
13491356 . expect ( "sandbox spec should be persisted at create time" ) ;
13501357 assert_eq ! ( spec. command, command) ;
13511358 assert ! ( !spec. tty) ;
1359+ assert ! ( requests[ 0 ] . await_main_process_attachment) ;
1360+ }
1361+
1362+ #[ tokio:: test]
1363+ async fn detached_command_does_not_declare_main_process_attachment ( ) {
1364+ let server = run_server ( ) . await ;
1365+ let fake_ssh_dir = tempfile:: tempdir ( ) . unwrap ( ) ;
1366+ let xdg_dir = tempfile:: tempdir ( ) . unwrap ( ) ;
1367+ let _env = test_env ( & fake_ssh_dir, & xdg_dir) ;
1368+ let tls = test_tls ( & server) ;
1369+ install_fake_ssh ( & fake_ssh_dir) ;
1370+
1371+ run:: sandbox_create (
1372+ & server. endpoint ,
1373+ "openshell" ,
1374+ run:: SandboxCreateConfig {
1375+ name : Some ( "detached-main" ) ,
1376+ command : & [ "echo" . into ( ) , "OK" . into ( ) ] ,
1377+ detach : true ,
1378+ ..test_config ( )
1379+ } ,
1380+ "default" ,
1381+ & tls,
1382+ )
1383+ . await
1384+ . expect ( "detached sandbox create should succeed" ) ;
1385+
1386+ let requests = create_requests ( & server) . await ;
1387+ assert ! ( !requests[ 0 ] . await_main_process_attachment) ;
13521388}
13531389
13541390#[ tokio:: test]
0 commit comments