|
@@ -1,5 +1,6 @@
|
|
import os
|
|
import os
|
|
import sys
|
|
import sys
|
|
|
|
+import threading
|
|
import time
|
|
import time
|
|
import uvicorn
|
|
import uvicorn
|
|
import subprocess
|
|
import subprocess
|
|
@@ -58,10 +59,10 @@ def call_sh(path: str):
|
|
:param path:
|
|
:param path:
|
|
:return:
|
|
:return:
|
|
"""
|
|
"""
|
|
- read = os.popen(f"sh {path}").read()
|
|
|
|
- print(read)
|
|
|
|
- return os.popen(f"sh {path}").read()
|
|
|
|
- # return subprocess.call(f"sh {path}")
|
|
|
|
|
|
+ # return os.popen(f"sh {path}").read()
|
|
|
|
+ os.system(f"sh {path} &")
|
|
|
|
+ return "请等待结果"
|
|
|
|
+
|
|
|
|
|
|
def run_shell(shell):
|
|
def run_shell(shell):
|
|
cmd = subprocess.Popen(shell, stdin=subprocess.PIPE, stderr=sys.stderr, close_fds=True,
|
|
cmd = subprocess.Popen(shell, stdin=subprocess.PIPE, stderr=sys.stderr, close_fds=True,
|
|
@@ -69,6 +70,7 @@ def run_shell(shell):
|
|
cmd.communicate()
|
|
cmd.communicate()
|
|
return cmd.returncode
|
|
return cmd.returncode
|
|
|
|
|
|
|
|
+
|
|
@app.post("/upload")
|
|
@app.post("/upload")
|
|
def upload(file: UploadFile = File(...), path: str = Form(...)):
|
|
def upload(file: UploadFile = File(...), path: str = Form(...)):
|
|
"""
|
|
"""
|