|
6 | 6 |
|
7 | 7 | _DETAILED_BASH_DESCRIPTION = """Execute a bash command in the terminal within a persistent shell session.
|
8 | 8 |
|
| 9 | +
|
9 | 10 | ### Command Execution
|
10 | 11 | * One command at a time: You can only execute one bash command at a time. If you need to run multiple commands sequentially, use `&&` or `;` to chain them together.
|
11 | 12 | * Persistent session: Commands execute in a persistent shell session where environment variables, virtual environments, and working directory persist between commands.
|
12 |
| -* Timeout: Commands have a soft timeout of 10 seconds, once that's reached, you have the option to continue or interrupt the command (see section below for details) |
| 13 | +* Soft timeout: Commands have a soft timeout of 10 seconds, once that's reached, you have the option to continue or interrupt the command (see section below for details) |
13 | 14 |
|
14 |
| -### Running and Interacting with Processes |
15 |
| -* Long running commands: For commands that may run indefinitely, run them in the background and redirect output to a file, e.g. `python3 app.py > server.log 2>&1 &`. For commands that need to run for a specific duration, like "sleep", you can set the "timeout" argument to specify a hard timeout in seconds. |
16 |
| -* Interact with running process: If a bash command returns exit code `-1`, this means the process is not yet finished. By setting `is_input` to `true`, you can: |
| 15 | +### Long-running Commands |
| 16 | +* For commands that may run indefinitely, run them in the background and redirect output to a file, e.g. `python3 app.py > server.log 2>&1 &`. |
| 17 | +* For commands that may run for a long time (e.g. installation or testing commands), or commands that run for a fixed amount of time (e.g. sleep), you should set the "timeout" parameter of your function call to an appropriate value. |
| 18 | +* If a bash command returns exit code `-1`, this means the process hit the soft timeout and is not yet finished. By setting `is_input` to `true`, you can: |
17 | 19 | - Send empty `command` to retrieve additional logs
|
18 | 20 | - Send text (set `command` to the text) to STDIN of the running process
|
19 | 21 | - Send control commands like `C-c` (Ctrl+C), `C-d` (Ctrl+D), or `C-z` (Ctrl+Z) to interrupt the process
|
| 22 | + - If you do C-c, you can re-start the process with a longer "timeout" parameter to let it run to completion |
20 | 23 |
|
21 | 24 | ### Best Practices
|
22 | 25 | * Directory verification: Before creating new directories or files, first verify the parent directory exists and is the correct location.
|
|
0 commit comments