MCPcopy Create free account
hub / github.com/Work-Fisher/code-claw / execute_bash

Function execute_bash

claw-code/rust/crates/runtime/src/bash.rs:67–100  ·  view source on GitHub ↗
(input: BashCommandInput)

Source from the content-addressed store, hash-verified

65}
66
67pub 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
102async fn execute_bash_async(
103 input: BashCommandInput,

Callers 3

run_bashFunction · 0.85
executes_simple_commandFunction · 0.85

Calls 8

sandbox_status_for_inputFunction · 0.85
prepare_commandFunction · 0.85
execute_bash_asyncFunction · 0.85
stderrMethod · 0.80
stdoutMethod · 0.80
stdinMethod · 0.80
buildMethod · 0.80
spawnMethod · 0.45

Tested by 2

executes_simple_commandFunction · 0.68