Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"You can use --overwrite to replace the existing trace "
"(or --continue to append\nwithout prompt)")
elif append is False:
logger.info("Removing existing trace directory %s", directory)
directory.rmtree()
directory.mkdir(parents=True)
else:
if append is True:
logger.warning("--continue was set but trace doesn't exist yet")
directory.mkdir()
# Runs the trace
database = directory / 'trace.sqlite3'
logger.info("Running program")
# Might raise _pytracer.Error
c = _pytracer.execute(binary, argv, database.path)
if c != 0:
if c & 0x0100:
logger.warning("Program appears to have been terminated by "
"signal %d", c & 0xFF)
else:
logger.warning("Program exited with non-zero code %d", c)
logger.info("Program completed")
return c
Runs the command with the tracer using a temporary sqlite3 database, then
reads it and dumps it out.
Not really useful, except for debugging.
"""
fd, database = Path.tempfile(prefix='reprozip_', suffix='.sqlite3')
os.close(fd)
try:
if args.arg0 is not None:
argv = [args.arg0] + args.cmdline[1:]
else:
argv = args.cmdline
logger.debug("Starting tracer, binary=%r, argv=%r",
args.cmdline[0], argv)
c = _pytracer.execute(args.cmdline[0], argv, database.path)
print("\n\n-----------------------------------------------------------"
"--------------------")
print_db(database)
if c != 0:
if c & 0x0100:
print("\nWarning: program appears to have been terminated by "
"signal %d" % (c & 0xFF))
else:
print("\nWarning: program exited with non-zero code %d" % c)
return c
finally:
database.remove()
"You can use --overwrite to replace the existing trace "
"(or --continue to append\nwithout prompt)")
elif append is False:
logging.info("Removing existing trace directory %s", directory)
directory.rmtree()
directory.mkdir(parents=True)
else:
if append is True:
logging.warning("--continue was set but trace doesn't exist yet")
directory.mkdir()
# Runs the trace
database = directory / 'trace.sqlite3'
logging.info("Running program")
# Might raise _pytracer.Error
c = _pytracer.execute(binary, argv, database.path, verbosity)
if c != 0:
if c & 0x0100:
logging.warning("Program appears to have been terminated by "
"signal %d", c & 0xFF)
else:
logging.warning("Program exited with non-zero code %d", c)
logging.info("Program completed")