aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2023-05-26 10:22:51 -0700
committerRichard Henderson <richard.henderson@linaro.org>2023-05-30 10:55:39 -0700
commit036cc75ca0bff26bfe75dc721e641d812cad3c09 (patch)
treee3cdedaa879ed4504d32dcca18e1e88fa971b3d5 /scripts
parentf26044717679331ba31ba9bb911e059a13a49599 (diff)
decodetree: Do not remove output_file from /dev
Nor report any PermissionError on remove. The primary purpose is testing with -o /dev/null. Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/decodetree.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/scripts/decodetree.py b/scripts/decodetree.py
index e4ef0a03cc..a9a0cd0fa3 100644
--- a/scripts/decodetree.py
+++ b/scripts/decodetree.py
@@ -71,7 +71,12 @@ def error_with_file(file, lineno, *args):
if output_file and output_fd:
output_fd.close()
- os.remove(output_file)
+ # Do not try to remove e.g. -o /dev/null
+ if not output_file.startswith("/dev"):
+ try:
+ os.remove(output_file)
+ except PermissionError:
+ pass
exit(0 if testforerror else 1)
# end error_with_file