Hi Aaron
You ignore an error case. Run the tcpdump with invalid option or argument.
In this case, process will raise directly KeyboardInterrupt exception, not 
run the while loop any more. We should return an error code with sys.exit(1).
What’s more, in this error case, the subprocess has exited already before we
terminate it. We should check subprocess state before call the 
'pipes.terminate()'.
I will submit v2, can you review it?

Don’t you see this issue on your target?
# ovs-tcpdump -i eth1 -nnn -w
tcpdump: option requires an argument -- 'w'
tcpdump version 4.5.1
libpcap version 1.5.3
Usage: tcpdump [-aAbdDefhHIJKlLnNOpqRStuUvxX] [ -B size ] [ -c count ]
                [ -C file_size ] [ -E algo:secret ] [ -F file ] [ -G seconds ]
                [ -i interface ] [ -j tstamptype ] [ -M secret ]
                [ -P in|out|inout ]
                [ -r file ] [ -s snaplen ] [ -T type ] [ -V file ] [ -w file ]
                [ -W filecount ] [ -y datalinktype ] [ -z command ]
                [ -Z user ] [ expression ]
Traceback (most recent call last):
  File "/root/ovs_master_dev_new/utilities/ovs-tcpdump", line 453, in <module>
    main()
  File "/root/ovs_master_dev_new/utilities/ovs-tcpdump", line 439, in main
    pipes.terminate()
  File "/usr/lib64/python2.7/subprocess.py", line 1551, in terminate
    self.send_signal(signal.SIGTERM)
  File "/usr/lib64/python2.7/subprocess.py", line 1546, in send_signal
    os.kill(self.pid, sig)
OSError: [Errno 3] No such process


# ovs-tcpdump -i eth1 -nnn -1
tcpdump: invalid option -- '1'
tcpdump version 4.5.1
libpcap version 1.5.3
Usage: tcpdump [-aAbdDefhHIJKlLnNOpqRStuUvxX] [ -B size ] [ -c count ]
                [ -C file_size ] [ -E algo:secret ] [ -F file ] [ -G seconds ]
                [ -i interface ] [ -j tstamptype ] [ -M secret ]
                [ -P in|out|inout ]
                [ -r file ] [ -s snaplen ] [ -T type ] [ -V file ] [ -w file ]
                [ -W filecount ] [ -y datalinktype ] [ -z command ]
                [ -Z user ] [ expression ]
Traceback (most recent call last):
  File "/root/ovs_master_dev_new/utilities/ovs-tcpdump", line 453, in <module>
    main()
  File "/root/ovs_master_dev_new/utilities/ovs-tcpdump", line 439, in main
    pipes.terminate()
  File "/usr/lib64/python2.7/subprocess.py", line 1551, in terminate
    self.send_signal(signal.SIGTERM)
  File "/usr/lib64/python2.7/subprocess.py", line 1546, in send_signal
    os.kill(self.pid, sig)
OSError: [Errno 3] No such process



Thanks.
Nick

> On Nov 10, 2016, at 12:47 AM, Aaron Conole <acon...@redhat.com> wrote:
> 
> Sorry for being unclear - I had separated the sys.exit() line because I
> disagree with that change.
> 
> You need to accommodate both error case for exits, and normal case.  I
> agree it's important.

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to