You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/mintlify/reference/camel.toolkits.terminal_toolkit.terminal_toolkit.mdx
+53-37Lines changed: 53 additions & 37 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -158,23 +158,24 @@ def shell_exec(
158
158
):
159
159
```
160
160
161
-
This function executes a shell command. The command can run in
162
-
blocking mode (waits for completion) or non-blocking mode
163
-
(runs in the background). A unique session ID is created for
164
-
each session.
161
+
Executes a shell command in blocking or non-blocking mode.
165
162
166
163
**Parameters:**
167
164
168
-
-**command** (str): The commandto execute.
169
-
-**block** (bool): If True, the command runs synchronously, waiting for it to complete or time out, and returns its full output. If False, the command runs asynchronously in the background.
170
-
-**id** (Optional[str]): A specific ID for the session. If not provided, a unique ID is generated for non-blocking sessions.
165
+
-**id** (str): A unique identifier for the command's session. This ID is used to interact with non-blocking processes.
166
+
-**command** (str): The shell command to execute.
167
+
-**block** (bool, optional): Determines the execution mode. Defaults to True. If `True` (blocking mode), the function waits for the command to complete and returns the full output. Use this for most commands . If `False` (non-blocking mode), the function starts the command in the background. Use this only for interactive sessions or long-running tasks, or servers.
171
168
172
169
**Returns:**
173
170
174
-
str: If block is True, returns the complete stdout and stderr.
175
-
If block is False, returns a message containing the new
176
-
session ID and the initial output from the command after
177
-
it goes idle.
171
+
str: The output of the command execution, which varies by mode.
172
+
In blocking mode, returns the complete standard output and
173
+
standard error from the command.
174
+
In non-blocking mode, returns a confirmation message with the
175
+
session `id`. To interact with the background process, use
176
+
other functions: `shell_view(id)` to see output,
177
+
`shell_write_to_process(id, "input")` to send input, and
0 commit comments