CVSSourceCodeManager.st
changeset 4181 7ada81ccac23
parent 4164 640b3d01efb9
child 4182 11078fb7ec8e
child 4185 9d2ac28be31b
--- a/CVSSourceCodeManager.st	Fri Dec 16 15:52:50 2016 +0100
+++ b/CVSSourceCodeManager.st	Thu Dec 29 20:43:55 2016 +0100
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 1995 by Claus Gittinger
               All Rights Reserved
@@ -1062,7 +1064,7 @@
      The doLog argument, if false suppresses a logEntry to be added
      in the cvs log file (used when reading / extracting history)"
 
-    |command cvsRoot rslt ok pathOfDir errorString|
+    |command cvsRoot rslt ok pathOfDir errorString osProcess|
 
     dirArg notNil ifTrue:[
         pathOfDir := dirArg asFilename pathName.
@@ -1102,78 +1104,50 @@
                     inDirectory:pathOfDir.
         ok := rslt notNil.
     ] ifFalse:[
+        osProcess := OSProcess new
+                        command:command;
+                        outStream:outStreamOrNil;
+                        errorStream:outStreamOrNil;
+                        directory:pathOfDir.
+
         Processor isDispatching ifFalse:[
             "/ special hack to allow source code access during the initialization
             "/ phase (when threading is not yet enabled in the ProcessorScheduler)
             "/ execute the command in this thread, as opposed to the code below.
-            (outStreamOrNil notNil or:[ errorStreamOrNil notNil]) ifTrue:[
-                rslt := ok := OperatingSystem executeCommand:command
-                                        inputFrom:nil
-                                        outputTo:outStreamOrNil
-                                        errorTo:errorStreamOrNil
-                                        auxFrom:nil
-                                        inDirectory:pathOfDir
-                                        lineWise:false
-                                        onError:[:status| false].
-            ] ifFalse:[
-                rslt := ok := OperatingSystem
-                                executeCommand:command
-                                errorTo:nil
-                                inDirectory:pathOfDir.
-            ].
+            ok := rslt := osProcess execute.
         ] ifTrue:[
-            CVSCommandSemaphore
-                critical:[
-                    |p errOut done|
-
-                    errOut := WriteStream on:''.
-                    p := [
-                                (outStreamOrNil notNil or:[ errorStreamOrNil notNil]) ifTrue:[
-                                    rslt := ok := OperatingSystem executeCommand:command
-                                                        inputFrom:nil
-                                                        outputTo:outStreamOrNil
-                                                        errorTo:errorStreamOrNil
-                                                        auxFrom:nil
-                                                        inDirectory:pathOfDir
-                                                        lineWise:false
-                                                        showWindow:false
-                                                        onError:[:status| false].
-                                ] ifFalse:[
-                                    rslt := ok := OperatingSystem
-                                                    executeCommand:command
-                                                    outputTo:errOut
-                                                    errorTo:errOut
-                                                    inDirectory:pathOfDir
-                                                    showWindow:false.
-                                ]
-                         ] fork.
-
-                    done := false.
-                    [done] whileFalse:[
-                        done := true.
-                        (p waitUntilTerminatedWithTimeout:self cvsCommandTimeout asSeconds) ifTrue:[
-                            (Dialog confirm:('CVS command timeout (%1) for:\\%2\\Hint: you can change this timeout in the launcher''s settings dialog.\Proceed?' withCRs
-                                                    bindWith:self cvsCommandTimeout with:command)) ifTrue:[
-                                done := false
-                            ] ifFalse:[
-                                ('CVSSourceCodeManager [info]: command timeout: ' , command) errorPrintCR.
-                                p terminate.
-                                ok := false.
-                                errorString := 'CVS command timeout'.
-                            ]
+            CVSCommandSemaphore critical:[
+                |errOut done|
+
+                errOut := WriteStream on:''.
+                osProcess errorStream:errOut.
+                ok := osProcess startProcess.
+
+                [
+                    done := true.
+                    (osProcess waitUntilFinishedWithTimeout:self cvsCommandTimeout) isNil ifTrue:[
+                        (Dialog confirm:('CVS command timeout (%1) for:\\%2\\Hint: you can change this timeout in the launcher''s settings dialog.\Proceed?' withCRs
+                                                bindWith:self cvsCommandTimeout with:command)) 
+                        ifTrue:[
+                            done := false
                         ] ifFalse:[
-                            ok ifFalse:[
-                                errorString := errOut contents.
-                            ].
-                        ]
-                    ].
-                ].
+                            ('CVSSourceCodeManager [info]: command timeout: ' , command) errorPrintCR.
+                            osProcess terminate.
+                            ok := false.
+                            errorString := 'CVS command timeout'.
+                        ].
+                    ] ifFalse:[
+                        ok := rslt := osProcess finishedWithSuccess.
+                        ok ifFalse:[
+                            errorString := errOut contents.
+                        ].
+                    ]
+                ] doUntil:[done].
+            ].
         ].
     ].
     ok ifFalse:[
         ('CVSSourceCodeManager [info]: command failed: ' , command) errorPrintCR.
-        self breakPoint:#cg.
-        self breakPoint:#jv.
         SourceCodeManagerError isHandled ifTrue:[
             SourceCodeManagerError raiseRequestErrorString:(errorString ? 'CVS Error').
         ].
@@ -4516,17 +4490,17 @@
             "/ The repair code will be removed at some time in the future...
 
             "/ temporary fix Felix' bad string translation:
-            (aString startsWith:'§Header:') ifTrue:[
-                (aString endsWith:'Exp §') ifTrue:[
+            (aString startsWith:'§Header:') ifTrue:[
+                (aString endsWith:'Exp §') ifTrue:[
                     fixedString := '$' , (aString copyFrom:3 to:(aString size - 2)) , '$'.
 
                     aClass isNil ifTrue:[
                         autoFixHolder value ifFalse:[
-                            Dialog information:'Attention: the CVS version string is corrupted (§-bug). Please fix it manually'.
+                            Dialog information:'Attention: the CVS version string is corrupted (§-bug). Please fix it manually'.
                         ]
                     ] ifFalse:[
                         (autoFixHolder value 
-                            or:[ Dialog confirm:('Attention: the CVS version string is corrupted in "%1" (§-bug). Fix it?' withCRs bindWith:aClass name) ]
+                            or:[ Dialog confirm:('Attention: the CVS version string is corrupted in "%1" (§-bug). Fix it?' withCRs bindWith:aClass name) ]
                         ) ifTrue:[
                             self updateVersionMethodOf:aClass for:fixedString.
                         ].
@@ -4534,7 +4508,7 @@
                 ].
             ].
 
-            "/ temporary fix Jan's bad Umlaut-removal (which results in Felix's bad § being removed):
+            "/ temporary fix Jan's bad Umlaut-removal (which results in Felix's bad § being removed):
             (aString startsWith:'Header: ') ifTrue:[
                 (aString endsWith:'Exp ') ifTrue:[
                     fixedString := '$' , aString , '$'.
@@ -5815,7 +5789,7 @@
     "/ $-Revision: rev $
     "/ $-Id:       fileName rev date time user state $
     "/
-    (firstWord = '$Header:' or:[firstWord = '§Header:']) ifTrue:[
+    (firstWord = '$Header:' or:[firstWord = '§Header:']) ifTrue:[
         d := firstWord first.
         s skipSeparators.
         nm := s throughAll:',v '.
@@ -5845,12 +5819,12 @@
         ^ info
     ].
 
-    (firstWord = '$Revision:' or:[firstWord = '§Revision:']) ifTrue:[
+    (firstWord = '$Revision:' or:[firstWord = '§Revision:']) ifTrue:[
         info revision:(s upToEnd asCollectionOfWords first).
         ^ info
     ].
 
-    (firstWord = '$Id:' or:[firstWord = '§Id:']) ifTrue:[
+    (firstWord = '$Id:' or:[firstWord = '§Id:']) ifTrue:[
         "/commented out by Jan Vrany, 2009/10/20
         "/according to http://svnbook.red-bean.com/en/1.5/svn.advanced.props.special.keywords.html
         "/svn has no support for $ Header $ expansion. Therefore