Skip to content
Browse files

Ignore errors from os.stat()

  • Loading branch information...
1 parent 651b733 commit a51ab5d9040304592009f0ead9c803a3a6a5daba @joh committed Sep 1, 2012
Showing with 6 additions and 2 deletions.
  1. +6 −2 when-changed.py
View
8 when-changed.py
@@ -75,8 +75,12 @@ def print_help(prog):
os.system(command)
except OSError as e:
- print e.strerror
- # TODO: Exit here?
+ # Some editors (like vim) will first write to a temporary
+ # file, then delete the original file before renaming the
+ # temporary file back to the original filename.
+ # Thus the original file might not exist at the moment
+ # we do os.stat() so we ignore any errors here.
+ pass
time.sleep(0.5)
except KeyboardInterrupt:

0 comments on commit a51ab5d

Please sign in to comment.
Something went wrong with that request. Please try again.