mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-08-24 07:26:29 +00:00
Rename input argument to stdin
This commit is contained in:
parent
8402a3afb2
commit
d7f4849877
1 changed files with 5 additions and 7 deletions
|
@ -1,14 +1,14 @@
|
||||||
|
|
||||||
|
|
||||||
def log_check_call(command, input=None):
|
def log_check_call(command, stdin=None):
|
||||||
status, stdout, stderr = log_call(command, input)
|
status, stdout, stderr = log_call(command, stdin)
|
||||||
if status != 0:
|
if status != 0:
|
||||||
from subprocess import CalledProcessError
|
from subprocess import CalledProcessError
|
||||||
raise CalledProcessError(status, ' '.join(command), '\n'.join(stderr))
|
raise CalledProcessError(status, ' '.join(command), '\n'.join(stderr))
|
||||||
return stdout
|
return stdout
|
||||||
|
|
||||||
|
|
||||||
def log_call(command, input=None):
|
def log_call(command, stdin=None):
|
||||||
import subprocess
|
import subprocess
|
||||||
import select
|
import select
|
||||||
|
|
||||||
|
@ -17,13 +17,11 @@ def log_call(command, input=None):
|
||||||
command_log = realpath(command[0]).replace('/', '.')
|
command_log = realpath(command[0]).replace('/', '.')
|
||||||
log = logging.getLogger(__name__ + command_log)
|
log = logging.getLogger(__name__ + command_log)
|
||||||
|
|
||||||
if input is not None:
|
if stdin is not None:
|
||||||
process = subprocess.Popen(command, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
process = subprocess.Popen(command, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
process.stdin.write(input+"\n")
|
process.stdin.write(stdin+"\n")
|
||||||
process.stdin.flush()
|
process.stdin.flush()
|
||||||
process.stdin.close()
|
process.stdin.close()
|
||||||
# (stdout,stderr) = process.communicate(input+"\n")
|
|
||||||
# return process.returncode, stdout, stderr
|
|
||||||
else:
|
else:
|
||||||
process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
stdout = []
|
stdout = []
|
||||||
|
|
Loading…
Add table
Reference in a new issue