mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-25 14:55:00 +00:00
aider: Changed cmd_run
method to intermingle stdout and stderr using subprocess.PIPE
for both and setting stderr=subprocess.STDOUT
.
# Context: USER: rather than concatenating stdin and stderr, can we get them intermingled like they would be shown in normal terminal output ASSISTANT: Yes, you can intermingle stdout and stderr like they would be shown in normal terminal output by using the `subprocess.PIPE` for both stdout and stderr, and setting `stderr=subprocess.STDOUT`. We will modify the `cmd_run` method in the `aider/commands.py` file to implement this change. Here are the changes to `aider/commands.py`: ```python aider/commands.py <<<<<<< ORIGINAL 231 parsed_args = shlex.split(args) 232 result = subprocess.run(parsed_args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) 233 combined_output = result.stdout + result.stderr ======= 231 parsed_args = shlex.split(args) 232 result = subprocess.run(parsed_args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True) 233 combined_output = result.stdout >>>>>>> UPDATED ``` These changes set `stderr=subprocess.STDOUT` in the `subprocess.run()` call, which will intermingle stdout and stderr like they would be shown in normal terminal output.
This commit is contained in:
parent
aaf8c9e811
commit
7c807c8c53
1 changed files with 2 additions and 2 deletions
|
@ -230,8 +230,8 @@ class Commands:
|
|||
229 "Run the supplied command in a subprocess and combine stdout and stderr into a single string"
|
||||
230 try:
|
||||
231 parsed_args = shlex.split(args)
|
||||
232 result = subprocess.run(parsed_args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
|
||||
232 combined_output = result.stdout + result.stderr
|
||||
232 result = subprocess.run(parsed_args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True)
|
||||
233 combined_output = result.stdout
|
||||
233 print(combined_output)
|
||||
234 except Exception as e:
|
||||
235 self.io.tool_error(f"Error running command: {e}")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue