Allow to use hg.bat as Mercurial executable on Windows.
This is usefull when one needs to wrap hg command or uses
a hand-compiled Mercurial from sources under Windows.
--- a/mercurial/HGCommand.st Tue May 27 16:22:31 2014 +0100
+++ b/mercurial/HGCommand.st Thu Jun 26 01:13:28 2014 +0200
@@ -672,7 +672,7 @@
!HGCommand methodsFor:'executing'!
execute
- | stdoutPipe stdout stderrPipe stderr pid environment status args spin |
+ | stdoutPipe stdout stderrPipe stderr pid environment status exe args spin |
self initialize.
@@ -689,8 +689,17 @@
environment at:'LANG' put:'C'.
environment at:'LC_MESSAGES' put:'C'.
+ exe := self executable.
args := self arguments.
+
OperatingSystem isMSWINDOWSlike ifTrue:[
+ (exe endsWith:'.bat') ifTrue:[
+ | cmd |
+ cmd := OperatingSystem pathOfCommand:'cmd'.
+ args := #( '/C' ) , args.
+ exe := cmd.
+
+ ].
args := String streamContents:[:s|
args
do:[:each | s nextPut:$"; nextPutAll: each; nextPut: $"]
@@ -703,7 +712,7 @@
Trace ifTrue:[
Logger log: 'cmd: executing: ' , (args isString ifTrue:[args] ifFalse:[args asStringWith:' ']) severity: #trace facility: 'HG'.
].
- pid := OperatingSystem exec:(self executable) withArguments:args
+ pid := OperatingSystem exec: exe withArguments:args
environment:environment
fileDescriptors:{0 . stdoutPipe second fileDescriptor . stderrPipe second fileDescriptor}
fork:true