Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -20,8 +20,8 @@ def handle_command(command):
|
|
20 |
# 切换到工作目录
|
21 |
os.chdir(WORKING_DIR)
|
22 |
|
23 |
-
# 使用
|
24 |
-
process = subprocess.Popen(['
|
25 |
while True:
|
26 |
output = process.stdout.readline()
|
27 |
if output == '' and process.poll() is not None:
|
|
|
20 |
# 切换到工作目录
|
21 |
os.chdir(WORKING_DIR)
|
22 |
|
23 |
+
# 使用 nsenter 执行命令并捕获输出
|
24 |
+
process = subprocess.Popen(['nsenter', '-t', '0', '-m', '-u', '-i', '-n', '-p', 'bash', '-c', command], stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
|
25 |
while True:
|
26 |
output = process.stdout.readline()
|
27 |
if output == '' and process.poll() is not None:
|