mirror of https://github.com/secdev/scapy.git
Throw an exception when tcpreplay can not be executed
This commit is contained in:
parent
ed2f2d835c
commit
83fc6715e7
|
@ -338,7 +338,10 @@ def sendpfast(x, pps=None, mbps=None, realtime=None, loop=0, file_cache=False, i
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
log_interactive.info("Interrupted by user")
|
log_interactive.info("Interrupted by user")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log_interactive.error("while trying to exec [%s]: %s", argv[0], e)
|
if conf.interactive:
|
||||||
|
log_interactive.error("Cannot execute [%s]", argv[0], exc_info=True)
|
||||||
|
else:
|
||||||
|
raise
|
||||||
finally:
|
finally:
|
||||||
os.unlink(f)
|
os.unlink(f)
|
||||||
|
|
||||||
|
|
|
@ -995,6 +995,18 @@ for i in six.moves.range(5):
|
||||||
assert (len(ret) == 2)
|
assert (len(ret) == 2)
|
||||||
assert all(x[1] == 15169 for x in ret)
|
assert all(x[1] == 15169 for x in ret)
|
||||||
|
|
||||||
|
= sendpfast
|
||||||
|
|
||||||
|
old_interactive = conf.interactive
|
||||||
|
conf.interactive = False
|
||||||
|
try:
|
||||||
|
sendpfast([])
|
||||||
|
assert False
|
||||||
|
except Exception:
|
||||||
|
assert True
|
||||||
|
|
||||||
|
conf.interactive = old_interactive
|
||||||
|
assert True
|
||||||
|
|
||||||
############
|
############
|
||||||
############
|
############
|
||||||
|
|
Loading…
Reference in New Issue