diff options
author | Mike Frysinger <vapier@google.com> | 2025-04-09 19:59:05 -0400 |
---|---|---|
committer | LUCI <gerrit-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2025-04-10 10:23:08 -0700 |
commit | 0214730c9afaf732b3571f3f63416fea9f98a65c (patch) | |
tree | 0feec359ea1c00d67f8d4f21c38c8fd6f4f528c9 /release | |
parent | daebd6cbc2ae642021bcc209484e7249edc656ea (diff) | |
download | git-repo-0214730c9afaf732b3571f3f63416fea9f98a65c.tar.gz |
launcher: switch command quoting to shlex.quote
Minor fix, but just in case, provides properly quoted commands for
people to copy & paste.
Change-Id: Ia9fce5c0df9f51cbed9d49861adcf6821251e46f
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/466821
Tested-by: Mike Frysinger <vapier@google.com>
Commit-Queue: Mike Frysinger <vapier@google.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
Diffstat (limited to 'release')
-rw-r--r-- | release/util.py | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/release/util.py b/release/util.py index df7a5638..c839b872 100644 --- a/release/util.py +++ b/release/util.py | |||
@@ -16,6 +16,7 @@ | |||
16 | 16 | ||
17 | import os | 17 | import os |
18 | import re | 18 | import re |
19 | import shlex | ||
19 | import subprocess | 20 | import subprocess |
20 | import sys | 21 | import sys |
21 | 22 | ||
@@ -35,12 +36,7 @@ KEYID_ECC = "E1F9040D7A3F6DAFAC897CD3D3B95DA243E48A39" | |||
35 | 36 | ||
36 | def cmdstr(cmd): | 37 | def cmdstr(cmd): |
37 | """Get a nicely quoted shell command.""" | 38 | """Get a nicely quoted shell command.""" |
38 | ret = [] | 39 | return " ".join(shlex.quote(x) for x in cmd) |
39 | for arg in cmd: | ||
40 | if not re.match(r"^[a-zA-Z0-9/_.=-]+$", arg): | ||
41 | arg = f'"{arg}"' | ||
42 | ret.append(arg) | ||
43 | return " ".join(ret) | ||
44 | 40 | ||
45 | 41 | ||
46 | def run(opts, cmd, check=True, **kwargs): | 42 | def run(opts, cmd, check=True, **kwargs): |