refactor: Update subprocess call to use shell=True with properly quoted command string

This commit is contained in:
Paul Gauthier (aider) 2025-02-24 09:22:34 -08:00
parent 0415de853b
commit 3714d554df

View file

@ -131,8 +131,9 @@ def pipe_editor(input_data="", suffix=None, editor=None):
filepath = write_temp_file(input_data, suffix)
command_parts = discover_editor(editor)
command_parts.append(filepath)
dump(command_parts)
subprocess.call(command_parts) # why does adding shell=True launch the editor without the filepath? ai?
command_str = " ".join(shlex.quote(part) for part in command_parts)
dump(command_str)
subprocess.call(command_str, shell=True)
with open(filepath, "r") as f:
output_data = f.read()
try: