Skip to content

Commit 75a71b5

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

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

scapy/sendrecv.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -586,11 +586,13 @@ def sendpfast(x: _PacketIterable,
586586
cmd = subprocess.Popen(argv, stdout=subprocess.PIPE,
587587
stderr=subprocess.PIPE)
588588
except KeyboardInterrupt:
589+
if cmd:
590+
cmd.terminate()
589591
log_interactive.info("Interrupted by user")
590592
except Exception:
591593
os.unlink(f)
592594
raise
593-
else:
595+
finally:
594596
stdout, stderr = cmd.communicate()
595597
if stderr:
596598
log_runtime.warning(stderr.decode())

0 commit comments

Comments
 (0)