| 65 | } |
| 66 | |
| 67 | pub fn execute_bash(input: BashCommandInput) -> io::Result<BashCommandOutput> { |
| 68 | let cwd = env::current_dir()?; |
| 69 | let sandbox_status = sandbox_status_for_input(&input, &cwd); |
| 70 | |
| 71 | if input.run_in_background.unwrap_or(false) { |
| 72 | let mut child = prepare_command(&input.command, &cwd, &sandbox_status, false); |
| 73 | let child = child |
| 74 | .stdin(Stdio::null()) |
| 75 | .stdout(Stdio::null()) |
| 76 | .stderr(Stdio::null()) |
| 77 | .spawn()?; |
| 78 | |
| 79 | return Ok(BashCommandOutput { |
| 80 | stdout: String::new(), |
| 81 | stderr: String::new(), |
| 82 | raw_output_path: None, |
| 83 | interrupted: false, |
| 84 | is_image: None, |
| 85 | background_task_id: Some(child.id().to_string()), |
| 86 | backgrounded_by_user: Some(false), |
| 87 | assistant_auto_backgrounded: Some(false), |
| 88 | dangerously_disable_sandbox: input.dangerously_disable_sandbox, |
| 89 | return_code_interpretation: None, |
| 90 | no_output_expected: Some(true), |
| 91 | structured_content: None, |
| 92 | persisted_output_path: None, |
| 93 | persisted_output_size: None, |
| 94 | sandbox_status: Some(sandbox_status), |
| 95 | }); |
| 96 | } |
| 97 | |
| 98 | let runtime = Builder::new_current_thread().enable_all().build()?; |
| 99 | runtime.block_on(execute_bash_async(input, sandbox_status, cwd)) |
| 100 | } |
| 101 | |
| 102 | async fn execute_bash_async( |
| 103 | input: BashCommandInput, |