mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-19 09:33:53 +00:00
Windows: Refactor Shell Scripts to Node.js for Cross-Platform Compatibility (#784)
This commit is contained in:
@@ -4,9 +4,9 @@ This document provides details on the shell tool.
|
||||
|
||||
## `run_shell_command`
|
||||
|
||||
- **Purpose:** Executes a given shell command using `bash -c <command>`. This tool is essential for interacting with the underlying operating system, running scripts, or performing command-line operations.
|
||||
- **Purpose:** Executes a given shell command. On Windows, this will be executed with `cmd.exe /c`. On other platforms, it will be executed with `bash -c`. This tool is essential for interacting with the underlying operating system, running scripts, or performing command-line operations.
|
||||
- **Arguments:**
|
||||
- `command` (string, required): The exact bash command to execute.
|
||||
- `command` (string, required): The exact shell command to execute.
|
||||
- `description` (string, optional): A brief description of the command's purpose, which will be shown to the user.
|
||||
- `directory` (string, optional): The directory (relative to the project root) in which to execute the command. If not provided, the command runs in the project root.
|
||||
- **Behavior:**
|
||||
@@ -22,10 +22,14 @@ This document provides details on the shell tool.
|
||||
- `Signal`: The signal number if the command was terminated by a signal.
|
||||
- `Background PIDs`: A list of PIDs for any background processes started.
|
||||
- **Examples:**
|
||||
|
||||
- Listing files in the current directory:
|
||||
|
||||
```
|
||||
|
||||
run_shell_command(command="ls -la")
|
||||
```
|
||||
|
||||
- Running a script in a specific directory:
|
||||
```
|
||||
run_shell_command(command="./my_script.sh", directory="scripts", description="Run my custom script")
|
||||
@@ -34,6 +38,7 @@ This document provides details on the shell tool.
|
||||
```
|
||||
run_shell_command(command="npm run dev &", description="Start development server in background")
|
||||
```
|
||||
|
||||
- **Important Notes:**
|
||||
- **Security:** Be cautious when executing commands, especially those constructed from user input, to prevent security vulnerabilities.
|
||||
- **Interactive Commands:** Avoid commands that require interactive user input, as this can cause the tool to hang. Use non-interactive flags if available (e.g., `npm init -y`).
|
||||
|
||||
Reference in New Issue
Block a user