Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Akegarasu committed Jul 12, 2023
1 parent 58ad041 commit 6b23fb5
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion mikazuki/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,16 @@ async def run_script(request: Request, background_tasks: BackgroundTasks):
if script_name not in avaliable_scripts:
return {"status": "fail"}
del j["script_name"]
cmd = script_name + ' ' + ' '.join(f'--{k} {v}' for k, v in j.items())
result = []
for k, v in j.items():
result.append(f"--{k}")
if not isinstance(v, bool):
value = str(v)
if " " in value:
value = f'"{v}"'
result.append(value)
script_args = " ".join(result)
cmd = f"{utils.python_bin} {script_name} {script_args}"
background_tasks.add_task(utils.run, cmd)
return {"status": "success"}

Expand Down

0 comments on commit 6b23fb5

Please sign in to comment.