diff options
author | João Valverde <j@v6e.pt> | 2021-09-25 05:39:55 +0100 |
---|---|---|
committer | Wireshark GitLab Utility <gerald+gitlab-utility@wireshark.org> | 2021-09-27 16:45:58 +0000 |
commit | 481d0716e5319e993f23fbded98cce93dc6a70ed (patch) | |
tree | 7965df008cf18d93a7a5c3a892fd9fbe28eac1a2 /test | |
parent | ef06593c13b7928b83fa4a254bb92ea27e96443c (diff) |
MSYS2: Test commands in pipes need quoting
At least using MSYS2 python (that uses system() that uses CMD.EXE)
we must quote every command in a pipe, otherwise the "'C:' is not
recognized as an internal or external program" error occurs.
Diffstat (limited to 'test')
-rw-r--r-- | test/suite_capture.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/test/suite_capture.py b/test/suite_capture.py index 81ce7420f4..97a971b8ea 100644 --- a/test/suite_capture.py +++ b/test/suite_capture.py @@ -70,10 +70,13 @@ def wireshark_k(wireshark_command): return tuple(list(wireshark_command) + ['-k']) -def capture_command(*cmd_args, shell=False): +def capture_command(*args, shell=False): + cmd_args = list(args) if type(cmd_args[0]) != str: # Assume something like ['wireshark', '-k'] cmd_args = list(cmd_args[0]) + list(cmd_args)[1:] + if sys.platform == "win32": + cmd_args[0] = '"{}"'.format(cmd_args[0]) if shell: cmd_args = ' '.join(cmd_args) return cmd_args @@ -243,7 +246,8 @@ def check_dumpcap_autostop_stdin(cmd_dumpcap): elif filesize is not None: condition = 'filesize:{}'.format(filesize) - capture_cmd = ' '.join((cmd_dumpcap, + cmd_ = '"{}"'.format(cmd_dumpcap) + capture_cmd = ' '.join((cmd_, '-i', '-', '-w', testout_file, '-a', condition, @@ -277,7 +281,8 @@ def check_dumpcap_ringbuffer_stdin(cmd_dumpcap): elif filesize is not None: condition = 'filesize:{}'.format(filesize) - capture_cmd = ' '.join((cmd_dumpcap, + cmd_ = '"{}"'.format(cmd_dumpcap) + capture_cmd = ' '.join((cmd_, '-i', '-', '-w', testout_file, '-a', 'files:2', |