feat: add null check for input
This commit is contained in:
parent
0ad9676196
commit
f863382d07
1 changed files with 6 additions and 2 deletions
|
@ -39,8 +39,12 @@ def exec(cmd, input=None):
|
||||||
else:
|
else:
|
||||||
print(' '.join(cmd))
|
print(' '.join(cmd))
|
||||||
else:
|
else:
|
||||||
|
if input != None:
|
||||||
subprocess.run(cmd, shell=False, stdout=sys.stdout,
|
subprocess.run(cmd, shell=False, stdout=sys.stdout,
|
||||||
stderr=sys.stderr, preexec_fn=preexec, input=input.encode()).returncode
|
stderr=sys.stderr, preexec_fn=preexec, input=input.encode()).returncode
|
||||||
|
else:
|
||||||
|
subprocess.run(cmd, shell=False, stdout=sys.stdout,
|
||||||
|
stderr=sys.stderr, preexec_fn=preexec).returncode
|
||||||
|
|
||||||
|
|
||||||
def exec_chroot(cmd):
|
def exec_chroot(cmd):
|
||||||
|
|
Loading…
Reference in a new issue