feat: add null check for input

This commit is contained in:
Rudra Saraswat 2024-06-08 07:21:30 +00:00
parent 0ad9676196
commit f863382d07

View file

@ -39,8 +39,12 @@ def exec(cmd, input=None):
else:
print(' '.join(cmd))
else:
subprocess.run(cmd, shell=False, stdout=sys.stdout,
stderr=sys.stderr, preexec_fn=preexec, input=input.encode()).returncode
if input != None:
subprocess.run(cmd, shell=False, stdout=sys.stdout,
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):