This commit is contained in:
John Lancaster
2024-06-14 23:34:27 -05:00
parent ca7f62afe3
commit 1cae18670a
7 changed files with 75 additions and 11 deletions

27
run_service.py Executable file
View File

@@ -0,0 +1,27 @@
#!/usr/bin/env python3
import os
import subprocess
from rich import print
os.chdir('/root')
cmd = ['code', 'tunnel']
# cmd = ['echo', '"Hello world"']
print('PATH:\n' + '\n'.join(f' - {p}' for p in os.environ['PATH'].split(':')))
try:
result = subprocess.run(
cmd,
shell=True,
env=os.environ,
text=True,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
)
result.check_returncode()
except subprocess.CalledProcessError as e:
print(e)
finally:
print(result.stdout)