Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
rth7680 committed May 30, 2023
1 parent f260447 commit 036cc75
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion scripts/decodetree.py
Expand Up @@ -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

Expand Down

0 comments on commit 036cc75

Please sign in to comment.