Skip to content

Commit d9950d4

Browse files
committed
predicate.py: Add an option to not delete temp files
Useful when debugging.
1 parent d4829d3 commit d9950d4

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

csmith-fuzzing/predicate.py

+11-5
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@
4545
default=BINDGEN_ARGS,
4646
help="An argument string that `bindgen` should be invoked with. By default, all traits are derived. Note that the input header and output bindings file will automatically be provided by this script, and you should not manually specify them.")
4747

48+
parser.add_argument(
49+
"--save-temp-files",
50+
action="store_true",
51+
help="Do not delete temporary files.")
52+
4853
parser.add_argument(
4954
"input",
5055
type=str,
@@ -144,11 +149,12 @@ def main():
144149
exit_code = 2
145150
print("Unexpected exception:", e)
146151

147-
for path in TEMP_FILES:
148-
try:
149-
os.remove(path)
150-
except Exception as e:
151-
print("Unexpected exception:", e)
152+
if not args.save_temp_files:
153+
for path in TEMP_FILES:
154+
try:
155+
os.remove(path)
156+
except Exception as e:
157+
print("Unexpected exception:", e)
152158

153159
sys.exit(exit_code)
154160

0 commit comments

Comments
 (0)