-
Notifications
You must be signed in to change notification settings - Fork 18.3k
Open
Labels
NeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.OS-Windowsearly-in-cycleA change that should be done early in the 3 month dev cycle.A change that should be done early in the 3 month dev cycle.
Milestone
Description
Go 1.7.1 on windows-amd64, Windows 10 latest.
Consider a test project:
src/github.com/calmh/wincmdtest/
main.go
folder name/
test.bat
main.go
contents:
package main
import (
"fmt"
"os/exec"
"strings"
)
func main() {
execCmd("./folder name/test.bat")
execCmd("./folder name/test.bat", "one param")
}
func execCmd(path string, args ...string) {
fmt.Printf("Running: %q %q\n", path, strings.Join(args, " "))
cmd := exec.Command(path, args...)
bs, err := cmd.CombinedOutput()
fmt.Printf("Output: %s", bs)
fmt.Printf("Error: %v\n\n", err)
}
folder name/test.bat
contents:
@echo off
echo Success
Expected output is two runs with "Success" in them.
Actual:
C:\Users\jb\Go\src\github.com\calmh\wincmdtest>go run main.go
Running: "./folder name/test.bat" ""
Output: Success
Error: <nil>
Running: "./folder name/test.bat" "one param"
Output: '.' is not recognized as an internal or external command,
operable program or batch file.
Error: exit status 1
It appears that having params on a command, where the command contains a space, breaks the parsing of it. I haven't been able to work around this by experimenting with various ways of quoting the command, using backslashes or slashes, etc.
siradam7th, tiulpin and jmooring
Metadata
Metadata
Assignees
Labels
NeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.OS-Windowsearly-in-cycleA change that should be done early in the 3 month dev cycle.A change that should be done early in the 3 month dev cycle.