WIP
This commit is contained in:
27
run_service.py
Executable file
27
run_service.py
Executable 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)
|
||||
Reference in New Issue
Block a user