Skip to content

Commit

Permalink
Ensure pcap_filter gets killed if a test fails
Browse files Browse the repository at this point in the history
  • Loading branch information
bonsaiviking committed Oct 6, 2021
1 parent fd6e80d commit f720bd2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/make_test.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
SET SAVEPID=0

echo Testing iflist...
for /f "TOKENS=1,2" %%a in ('nmap --iflist') do @if %%a==lo0 set devname=%%b
if not %devname:~0,12%==\Device\NPF_ goto :error
Expand All @@ -18,6 +20,7 @@ echo Testing sendpack...

echo Killing pcap_filter...
taskkill /PID %SAVEPID% || goto :error
SET SAVEPID=0

echo Reading dump file...
.\readfile.exe loopback.pcap || goto :error
Expand Down Expand Up @@ -48,6 +51,7 @@ echo Testing sendpack...

echo Killing pcap_filter...
taskkill /PID %SAVEPID% || goto :error
SET SAVEPID=0

echo Reading dump file...
.\readfile.exe scanme.pcap || goto :error
Expand All @@ -60,5 +64,6 @@ exit /b

:error
echo Failed: %errorlevel%
if %SAVEPID% NEQ 0 taskkill /PID %SAVEPID%
pause
exit /b %errorlevel%

0 comments on commit f720bd2

Please sign in to comment.