[Unison-hackers] [unison-svn] r500 - trunk/src
vouillon at seas.upenn.edu
vouillon at seas.upenn.edu
Tue Aug 7 12:33:59 EDT 2012
Author: vouillon
Date: 2012-08-07 12:33:59 -0400 (Tue, 07 Aug 2012)
New Revision: 500
Modified:
trunk/src/RECENTNEWS
trunk/src/fsmonitor.py
trunk/src/mkProjectInfo.ml
trunk/src/uitext.ml
Log:
* fsmonitor.py: fixed busy wait under Windows
* fsmonitor.py: make sure this helper program exits when Unison terminates
(now, fsmonitor.py exits when stdin is closed, and Unison redirects stdin)
Modified: trunk/src/RECENTNEWS
===================================================================
--- trunk/src/RECENTNEWS 2012-08-07 16:24:45 UTC (rev 499)
+++ trunk/src/RECENTNEWS 2012-08-07 16:33:59 UTC (rev 500)
@@ -1,3 +1,10 @@
+CHANGES FROM VERSION 2.45.12
+
+* fsmonitor.py: fixed busy wait under Windows
+* fsmonitor.py: make sure this helper program exits when Unison terminates
+ (now, fsmonitor.py exits when stdin is closed, and Unison redirects stdin)
+
+-------------------------------
CHANGES FROM VERSION 2.45.11
* Fix bug in Lwt_unix.sleep
Modified: trunk/src/fsmonitor.py
===================================================================
--- trunk/src/fsmonitor.py 2012-08-07 16:24:45 UTC (rev 499)
+++ trunk/src/fsmonitor.py 2012-08-07 16:33:59 UTC (rev 500)
@@ -11,8 +11,9 @@
import sys
import os
import stat
+import threading
from optparse import OptionParser
-from time import time
+from time import time, sleep
def mydebug(fmt, *args, **kwds):
if not op.debug:
@@ -375,15 +376,16 @@
#now we should know what to do: build a file directory list
#I assume here, that unison takes a flag for recursive scans
- if recursive:
- #we have to check all subdirectories
- if isinstance(path,list):
- #we have to check all base paths
- allpathsrecursive = [p + '\tr']
- result.extend(path)
- else:
- result.append(path+'\tr')
- else:
+#JV: commented out (not implemented by Unison)
+# if recursive:
+# #we have to check all subdirectories
+# if isinstance(path,list):
+# #we have to check all base paths
+# allpathsrecursive = [p + '\tr']
+# result.extend(path)
+# else:
+# result.append(path+'\tr')
+# else:
#just add the path
#result.append(path)
#try to find out what has changed
@@ -492,7 +494,6 @@
if sys.platform == 'win32':
import win32file
import win32con
- import threading
FILE_LIST_DIRECTORY = 0x0001
@@ -538,7 +539,7 @@
try:
while 1:
- pass
+ sleep(3600)
except KeyboardInterrupt:
print "Cleaning up."
@@ -658,6 +659,14 @@
mymesg('failed to open output file. STOP.')
exit(1)
+ #stop watching when stdin is closed
+ def exitThread():
+ while sys.stdin.readline(): pass
+ os._exit(0)
+ t = threading.Thread(target=exitThread)
+ t.setDaemon(True)
+ t.start()
+
if sys.platform=='darwin':
macosxwatcher()
elif sys.platform.startswith('linux'):
Modified: trunk/src/mkProjectInfo.ml
===================================================================
--- trunk/src/mkProjectInfo.ml 2012-08-07 16:24:45 UTC (rev 499)
+++ trunk/src/mkProjectInfo.ml 2012-08-07 16:33:59 UTC (rev 500)
@@ -74,3 +74,4 @@
+
Modified: trunk/src/uitext.ml
===================================================================
--- trunk/src/uitext.ml 2012-08-07 16:24:45 UTC (rev 499)
+++ trunk/src/uitext.ml 2012-08-07 16:33:59 UTC (rev 500)
@@ -813,7 +813,7 @@
let (changefile,cmd) = watchercmd r in
debug (fun() -> Util.msg
"Starting watcher on root %s\n" (Common.root2string r));
- let _ = System.open_process_in cmd in
+ let _ = System.open_process_out cmd in
let wi = {file = changefile; ch = ref None;
lines = ref []; chars = ref ""} in
watchers := RootMap.add r wi !watchers;
More information about the Unison-hackers
mailing list