fix: file input with subprocess

This commit is contained in:
Revant Nandgaonkar
2020-07-10 16:18:25 +05:30
parent 31ff697835
commit 4598cb24f4
2 changed files with 6 additions and 6 deletions

View File

@@ -1,10 +1,10 @@
import subprocess
def run_command(command, stdout=None, stderr=None):
def run_command(command, stdout=None, stdin=None, stderr=None):
stdout = stdout or subprocess.PIPE
stderr = stderr or subprocess.PIPE
process = subprocess.Popen(command, stdout=stdout, stderr=stderr)
process = subprocess.Popen(command, stdout=stdout, stdin=stdin, stderr=stderr)
out, error = process.communicate()
if process.returncode:
print("Something went wrong:")