HGCommand: changed: #execute: on Windows arguments must be passed as string.
authorvranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
Wed, 14 Nov 2012 21:41:23 +0000
changeset 52 281850dff0ac
parent 51 61700cf82743
child 53 8043f7b6f41a
HGCommand: changed: #execute: on Windows arguments must be passed as string.
mercurial/HGCommand.st
--- a/mercurial/HGCommand.st	Wed Nov 14 20:03:01 2012 +0000
+++ b/mercurial/HGCommand.st	Wed Nov 14 21:41:23 2012 +0000
@@ -170,16 +170,30 @@
 !HGCommand methodsFor:'executing'!
 
 execute
-    | pipe output pid environment sema status retval |
+    | pipe output pid environment sema status retval args |
 
     pipe := NonPositionableExternalStream makePipe.
     output := pipe first.
-    environment := OperatingSystem getEnvironment copy.
+
+    OperatingSystem isUNIXlike ifTrue:[
+        environment := OperatingSystem getEnvironment copy.
+    ] ifFalse:[
+        environment := Dictionary new.
+    ].
+    environment at:'LANG' put:'C'.
 
-    environment at:'LANG' put:'C'.
+    args := self arguments.
+    OperatingSystem isMSWINDOWSlike ifTrue:[
+        args := String streamContents:[:s|
+            args 
+                do:[:each | s nextPut:$"; nextPutAll: each; nextPut: $"]
+                separatedBy: [ s space ]
+        ]
+    ].
+
     sema := Semaphore new name: 'Waiting for hg command to finish'.
     Processor monitor:[
-        pid := OperatingSystem exec:(self executable) withArguments:(self arguments)
+        pid := OperatingSystem exec:(self executable) withArguments:args
             environment:environment
             fileDescriptors:{0 . pipe second fileDescriptor . pipe second fileDescriptor}
             fork:true 
@@ -215,6 +229,7 @@
     "Modified: / 17-12-2011 / 19:22:00 / dundee"
     "Modified (format): / 27-12-2011 / 15:53:54 / dundee"
     "Modified: / 14-11-2012 / 20:01:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 14-11-2012 / 13:41:57 / jv"
 ! !
 
 !HGCommand methodsFor:'private'!