Skip to content

Commit 15f9bc2

Browse files
Fix bugs if stopping sendpfast via Ctrl+C (secdev#4690)
* Fix bugs if stopping sendpfast via Ctrl+C
1 parent a4f958b commit 15f9bc2

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

scapy/sendrecv.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -585,12 +585,15 @@ def sendpfast(x: _PacketIterable,
585585
try:
586586
cmd = subprocess.Popen(argv, stdout=subprocess.PIPE,
587587
stderr=subprocess.PIPE)
588+
cmd.wait()
588589
except KeyboardInterrupt:
590+
if cmd:
591+
cmd.terminate()
589592
log_interactive.info("Interrupted by user")
590593
except Exception:
591594
os.unlink(f)
592595
raise
593-
else:
596+
finally:
594597
stdout, stderr = cmd.communicate()
595598
if stderr:
596599
log_runtime.warning(stderr.decode())

0 commit comments

Comments
 (0)