Skip to content

Commit

Permalink
Fixing timeout being written to stderr
Browse files Browse the repository at this point in the history
  • Loading branch information
GDeLaurentis committed Feb 12, 2025
1 parent c869791 commit 5768652
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions syngular/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ def execute_singular_command(singular_command, timeout='default', verbose=False)
file_path = f"/tmp/.singular_commands/singular_command_{random_integer}"
with open(file_path, "w+") as file:
file.write(singular_command)
test = subprocess.Popen(["timeout", "--verbose", str(timeout), "Singular", "--quiet", file_path], stdin=subprocess.PIPE, stdout=subprocess.PIPE)
test = subprocess.Popen(["timeout", "--verbose", str(timeout), "Singular", "--quiet", file_path, "2>&1"],
stdin=subprocess.PIPE, stdout=subprocess.PIPE)
else:
test = subprocess.Popen(["timeout", "--verbose", str(timeout), "Singular", "--quiet", "--execute", singular_command], stdin=subprocess.PIPE, stdout=subprocess.PIPE)
test = subprocess.Popen(["timeout", "--verbose", str(timeout), "Singular", "--quiet", "--execute", singular_command, "2>&1"],
stdin=subprocess.PIPE, stdout=subprocess.PIPE)
try:
output = test.communicate()[0]
except KeyboardInterrupt:
Expand Down

0 comments on commit 5768652

Please sign in to comment.