Skip to content

Commit

Permalink
Ignore errors from os.stat()
Browse files Browse the repository at this point in the history
  • Loading branch information
joh committed Aug 31, 2012
1 parent 651b733 commit a51ab5d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions when-changed.py
Expand Up @@ -75,8 +75,12 @@ def print_help(prog):
os.system(command) os.system(command)


except OSError as e: except OSError as e:
print e.strerror # Some editors (like vim) will first write to a temporary
# TODO: Exit here? # 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) time.sleep(0.5)
except KeyboardInterrupt: except KeyboardInterrupt:
Expand Down

0 comments on commit a51ab5d

Please sign in to comment.