forked from osmocom/wireshark
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.
This commit is contained in:
parent
ef06593c13
commit
481d0716e5
|
@ -70,10 +70,13 @@ def wireshark_k(wireshark_command):
|
||||||
return tuple(list(wireshark_command) + ['-k'])
|
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:
|
if type(cmd_args[0]) != str:
|
||||||
# Assume something like ['wireshark', '-k']
|
# Assume something like ['wireshark', '-k']
|
||||||
cmd_args = list(cmd_args[0]) + list(cmd_args)[1:]
|
cmd_args = list(cmd_args[0]) + list(cmd_args)[1:]
|
||||||
|
if sys.platform == "win32":
|
||||||
|
cmd_args[0] = '"{}"'.format(cmd_args[0])
|
||||||
if shell:
|
if shell:
|
||||||
cmd_args = ' '.join(cmd_args)
|
cmd_args = ' '.join(cmd_args)
|
||||||
return cmd_args
|
return cmd_args
|
||||||
|
@ -243,7 +246,8 @@ def check_dumpcap_autostop_stdin(cmd_dumpcap):
|
||||||
elif filesize is not None:
|
elif filesize is not None:
|
||||||
condition = 'filesize:{}'.format(filesize)
|
condition = 'filesize:{}'.format(filesize)
|
||||||
|
|
||||||
capture_cmd = ' '.join((cmd_dumpcap,
|
cmd_ = '"{}"'.format(cmd_dumpcap)
|
||||||
|
capture_cmd = ' '.join((cmd_,
|
||||||
'-i', '-',
|
'-i', '-',
|
||||||
'-w', testout_file,
|
'-w', testout_file,
|
||||||
'-a', condition,
|
'-a', condition,
|
||||||
|
@ -277,7 +281,8 @@ def check_dumpcap_ringbuffer_stdin(cmd_dumpcap):
|
||||||
elif filesize is not None:
|
elif filesize is not None:
|
||||||
condition = 'filesize:{}'.format(filesize)
|
condition = 'filesize:{}'.format(filesize)
|
||||||
|
|
||||||
capture_cmd = ' '.join((cmd_dumpcap,
|
cmd_ = '"{}"'.format(cmd_dumpcap)
|
||||||
|
capture_cmd = ' '.join((cmd_,
|
||||||
'-i', '-',
|
'-i', '-',
|
||||||
'-w', testout_file,
|
'-w', testout_file,
|
||||||
'-a', 'files:2',
|
'-a', 'files:2',
|
||||||
|
|
Loading…
Reference in New Issue