summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/llnl/util/filesystem.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/spack/llnl/util/filesystem.py b/lib/spack/llnl/util/filesystem.py
index 1d7b9ff7a3..5ed4d9249a 100644
--- a/lib/spack/llnl/util/filesystem.py
+++ b/lib/spack/llnl/util/filesystem.py
@@ -136,7 +136,7 @@ def filter_file(regex, repl, *filenames, **kwargs):
raise
finally:
- if not backup:
+ if not backup and os.path.exists(backup_filename):
os.remove(backup_filename)