mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-22 14:26:00 +00:00
fix(ctl): native rejects --env without = and timeouts outside 0-600 s
This commit is contained in:
1 parent
feff334c91
commit
5a626cd27a
2 files changed
+14
-1
No files matched your search
+8
-1
@@ -785,7 +785,14 @@ def execute(args: argparse.Namespace, adb: str, serial: str) -> dict:
|
||||
argv = args.argv[1:] if args.argv[:1] == ["--"] else args.argv
|
||||
if not argv:
|
||||
raise ControlError("native needs a command after --", "INVALID_ARGUMENTS")
|
||||
env = dict(item.partition("=")[::2] for item in args.env or [])
|
||||
if not 0 < args.timeout <= 600:
|
||||
raise ControlError("--timeout must be more than 0 and at most 600 seconds", "INVALID_ARGUMENTS")
|
||||
env = {}
|
||||
for item in args.env or []:
|
||||
key, sep, value = item.partition("=")
|
||||
if not sep:
|
||||
raise ControlError(f"--env takes KEY=VALUE, not {item}", "INVALID_ARGUMENTS")
|
||||
env[key] = value
|
||||
request = {"argv": argv, "timeout": args.timeout, "env": env}
|
||||
if args.cwd:
|
||||
request["cwd"] = args.cwd
|
||||
|
||||
Reference in new issue
Block a user