equal
deleted
inserted
replaced
670 ! ! |
670 ! ! |
671 |
671 |
672 !HGCommand methodsFor:'executing'! |
672 !HGCommand methodsFor:'executing'! |
673 |
673 |
674 execute |
674 execute |
675 | stdoutPipe stdout stderrPipe stderr pid environment status args spin | |
675 | stdoutPipe stdout stderrPipe stderr pid environment status exe args spin | |
676 |
676 |
677 self initialize. |
677 self initialize. |
678 |
678 |
679 stdoutPipe := NonPositionableExternalStream makePipe. |
679 stdoutPipe := NonPositionableExternalStream makePipe. |
680 stdout := stdoutPipe first. |
680 stdout := stdoutPipe first. |
687 ifFalse:[environment := Dictionary new]. |
687 ifFalse:[environment := Dictionary new]. |
688 environment at: 'HGEDITOR' put: 'true'. |
688 environment at: 'HGEDITOR' put: 'true'. |
689 environment at:'LANG' put:'C'. |
689 environment at:'LANG' put:'C'. |
690 environment at:'LC_MESSAGES' put:'C'. |
690 environment at:'LC_MESSAGES' put:'C'. |
691 |
691 |
|
692 exe := self executable. |
692 args := self arguments. |
693 args := self arguments. |
|
694 |
693 OperatingSystem isMSWINDOWSlike ifTrue:[ |
695 OperatingSystem isMSWINDOWSlike ifTrue:[ |
|
696 (exe endsWith:'.bat') ifTrue:[ |
|
697 | cmd | |
|
698 cmd := OperatingSystem pathOfCommand:'cmd'. |
|
699 args := #( '/C' ) , args. |
|
700 exe := cmd. |
|
701 |
|
702 ]. |
694 args := String streamContents:[:s| |
703 args := String streamContents:[:s| |
695 args |
704 args |
696 do:[:each | s nextPut:$"; nextPutAll: each; nextPut: $"] |
705 do:[:each | s nextPut:$"; nextPutAll: each; nextPut: $"] |
697 separatedBy: [ s space ] |
706 separatedBy: [ s space ] |
698 ] |
707 ] |
701 |
710 |
702 Processor monitor:[ |
711 Processor monitor:[ |
703 Trace ifTrue:[ |
712 Trace ifTrue:[ |
704 Logger log: 'cmd: executing: ' , (args isString ifTrue:[args] ifFalse:[args asStringWith:' ']) severity: #trace facility: 'HG'. |
713 Logger log: 'cmd: executing: ' , (args isString ifTrue:[args] ifFalse:[args asStringWith:' ']) severity: #trace facility: 'HG'. |
705 ]. |
714 ]. |
706 pid := OperatingSystem exec:(self executable) withArguments:args |
715 pid := OperatingSystem exec: exe withArguments:args |
707 environment:environment |
716 environment:environment |
708 fileDescriptors:{0 . stdoutPipe second fileDescriptor . stderrPipe second fileDescriptor} |
717 fileDescriptors:{0 . stdoutPipe second fileDescriptor . stderrPipe second fileDescriptor} |
709 fork:true |
718 fork:true |
710 newPgrp:false |
719 newPgrp:false |
711 inDirectory:self workingDirectory |
720 inDirectory:self workingDirectory |