diff --git a/cmdeploy/src/cmdeploy/lxc/incus.py b/cmdeploy/src/cmdeploy/lxc/incus.py index ca7df433..740b77d2 100644 --- a/cmdeploy/src/cmdeploy/lxc/incus.py +++ b/cmdeploy/src/cmdeploy/lxc/incus.py @@ -128,7 +128,7 @@ class Incus: proc = subprocess.Popen( cmd, text=True, - stdin=subprocess.PIPE if input else None, + stdin=subprocess.PIPE if input else subprocess.DEVNULL, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, ) diff --git a/cmdeploy/src/cmdeploy/util.py b/cmdeploy/src/cmdeploy/util.py index 3832202b..83bc5ea9 100644 --- a/cmdeploy/src/cmdeploy/util.py +++ b/cmdeploy/src/cmdeploy/util.py @@ -90,6 +90,7 @@ class Out: cmd, shell=True, text=True, + stdin=subprocess.DEVNULL, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, env=env, @@ -133,6 +134,7 @@ def shell(cmd, check=False, **kwargs): """ if "capture_output" not in kwargs and "stdout" not in kwargs: kwargs["capture_output"] = True + kwargs.setdefault("stdin", subprocess.DEVNULL) return subprocess.run(collapse(cmd), shell=True, text=True, check=check, **kwargs)