22 lines
517 B
Python
22 lines
517 B
Python
import os
|
|
import subprocess
|
|
|
|
|
|
def run_command(args):
|
|
return subprocess.run(args, capture_output=True, text=True)
|
|
|
|
|
|
def run_command_background(args, extra_env=None):
|
|
env = os.environ.copy()
|
|
if extra_env:
|
|
env.update({key: "" if value is None else str(value) for key, value in extra_env.items()})
|
|
|
|
return subprocess.Popen(
|
|
args,
|
|
env=env,
|
|
stdout=subprocess.DEVNULL,
|
|
stderr=subprocess.DEVNULL,
|
|
stdin=subprocess.DEVNULL,
|
|
start_new_session=True,
|
|
)
|