author | Stefan Vogel <sv@exept.de> |
Tue, 21 Feb 2017 18:34:44 +0100 | |
changeset 21510 | 2ef287a4be37 |
parent 21509 | a02e65126cb3 |
child 21511 | 3cf003d0c399 |
--- a/Win32OperatingSystem.st Tue Feb 21 18:13:56 2017 +0100 +++ b/Win32OperatingSystem.st Tue Feb 21 18:34:44 2017 +0100 @@ -3607,8 +3607,8 @@ |shell args wDir cmdName path| aCommandString isNonByteCollection ifTrue:[ - "easy: the caller does not want a shell to be executed" - ^ Array with:aCommandString first with:(aCommandString asStringWith:' ') with:nil. + "easy: the caller does not want a shell to be executed" + ^ Array with:aCommandString first with:(aCommandString asStringWith:' ') with:nil. ]. "/ @@ -3634,52 +3634,52 @@ cmdName := (aCommandString ? '') withoutSeparators. (cmdName isEmpty or:[cmdName includesAny:'<>|']) ifFalse:[ - "/ test whether the command is a plain executable; - "/ if so, no shell is required - |index file suffix| - - index := cmdName indexOfSeparatorStartingAt:1. - index ~~ 0 ifTrue:[ - cmdName := cmdName copyFrom:1 to:(index-1). - args := cmdName copyFrom:(index+1). - ] ifFalse:[ - args := ''. - ]. - - (cmdName first = $" and:[cmdName last = $"]) ifTrue:[ - cmdName := (cmdName copyFrom:2 to:cmdName size - 1) withoutSeparators. - ]. - file := cmdName asFilename. - file suffix isEmpty ifTrue:[ - file := file withSuffix:'exe'. - ]. - path := file fullAlternativePathName. - (OperatingSystem getBinaryType:path) notNil ifTrue:[ - "/ is an executable, no shell required - ^ Array with:path with:aCommandString with:nil. + "/ test whether the command is a plain executable; + "/ if so, no shell is required + |index file suffix| + + index := cmdName indexOfSeparatorStartingAt:1. + index ~~ 0 ifTrue:[ + cmdName := cmdName copyFrom:1 to:(index-1). + args := cmdName copyFrom:(index+1). + ] ifFalse:[ + args := ''. + ]. + + (cmdName first = $" and:[cmdName last = $"]) ifTrue:[ + cmdName := (cmdName copyFrom:2 to:cmdName size - 1) withoutSeparators. + ]. + file := cmdName asFilename. + file suffix isEmpty ifTrue:[ + file := file withSuffix:'exe'. + ]. + path := file fullAlternativePathName. + (OperatingSystem getBinaryType:path) notNil ifTrue:[ + "/ is an executable, no shell required + ^ Array with:path with:aCommandString with:nil. "/ ^ Array with:path with:(path, ' ', args). - ]. - path := self pathOfCommand:cmdName. - (path notNil and:[(OperatingSystem getBinaryType:path) notNil]) ifTrue:[ - "/ is an executable, no shell required - ^ Array with:path with:aCommandString with:nil. + ]. + path := self pathOfCommand:cmdName. + (path notNil and:[(OperatingSystem getBinaryType:path) notNil]) ifTrue:[ + "/ is an executable, no shell required + ^ Array with:path with:aCommandString with:nil. "/ ^ Array with:path with:(path, ' ', args). - ]. + ]. ]. shell := self getEnvironment:'COMSPEC'. shell isNil ifTrue:[ - wDir := self getWindowsSystemDirectory asFilename. - shell := #('cmd.exe' 'command.com') detect:[:eachCommand| - (wDir / eachCommand) isExecutableProgram - ] ifNone:[ - self error:'no cmd.exe available'. - ]. - shell := (wDir / shell) pathName. + wDir := self getWindowsSystemDirectory asFilename. + shell := #('cmd.exe' 'command.com') detect:[:eachCommand| + (wDir / eachCommand) isExecutableProgram + ] ifNone:[ + self error:'no cmd.exe available'. + ]. + shell := (wDir / shell) pathName. ]. cmdName isEmpty ifTrue:[ - ^ Array with:shell with:nil with:nil. + ^ Array with:shell with:'' with:nil. ]. ^ Array with:shell with:(' /c "' , aCommandString, '"') with:false.