Tuesday, October 30, 2012

Sleep in Windows

Many of us are aware that there is no sleep in Windows. For those of us who don't want Cygwin or something similar, I wrote this stupid little script just now.

#!/usr/bin/env python2 from time import sleep from sys import argv, stderr, exit try: duration = int(argv[1]) if duration <= 0: raise ValueError sleep(duration) except (IndexError, ValueError): print >>stderr, 'Usage: %s duration' % argv[0]

It's not significant, but I am not amused by the lack of such a command in Windows.

Post a Comment