Commit 03429b4
helpers/labgrid-raw-interface: fix tcpdump timeout handling
The current tcpdump timeout handling does not work.
This is supposed to exit after 5 seconds:
tcpdump --interface=eth0 -w - -G 5 -W 1
But that does not work if no packets are received.
So in order to make the timeout actually work, prefix tcpdump with
coreutils' timeout command instead:
timeout --signal=INT --preserve-status <timeout> <tcpdump command>
By sending SIGINT (`--signal=INT`), tcpdump exits gracefully and finishes
writing received packets. Combined with `--preserve-status`, tcpdump's
actual exit status is preserved, being 0 even on SIGINT if nothing else
went wrong.
An alternative would be to use subprocess, but that would prevent us
from using `os.execvp()`, replacing the process. So the timeout command
is the better approach here.
Signed-off-by: Bastian Krause <bst@pengutronix.de>1 parent bf38749 commit 03429b4
1 file changed
Lines changed: 1 addition & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
| 76 | + | |
82 | 77 | | |
83 | 78 | | |
84 | 79 | | |
| |||
0 commit comments