8d824dee6437

Touch the cache if it does not exist to prevent multiple forks.
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Tue, 14 Jul 2009 22:27:36 -0400
parents 7a87d26c99ac
children 64bc932ebad4
branches/tags (none)
files prompt.py

Changes

diff -r 7a87d26c99ac -r 8d824dee6437 prompt.py
--- a/prompt.py	Tue Jul 14 22:24:27 2009 -0400
+++ b/prompt.py	Tue Jul 14 22:27:36 2009 -0400
@@ -119,6 +119,8 @@
             cache_time = (datetime.fromtimestamp(os.stat(cache).st_mtime)
                           if cache_exists else None)
             if not cache_exists or cache_time < datetime.now() - CACHE_TIMEOUT:
+                if not cache_exists:
+                    open(cache, 'w').close()
                 subprocess.Popen(['hg', 'prompt', '--cache-%s' % kind])
             
             if cache_exists: