-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Closed
Labels
Description
What steps will reproduce the problem? 1.put test.go and test.bat in same directory. 2.compile test.go & run. What is the expected output? false true false true What do you see instead? true true false true Which compiler are you using (5g, 6g, 8g, gccgo)? 8g Which operating system are you using? WindowsXP SP3 Which revision are you using? (hg identify) 5323e969c66a+ tip Please provide any additional information below. https://groups.google.com/d/topic/golang-dev/ujtLlrp8e_c/discussion This cause: 1. Batch files don't pass exit code to parent process. You can only get %ERRORLEVEL%. 2. Batch file is kicked with new console in cmd.exe. 3. If use 'call' command, cmd.exe can get the exit code. See LINE3 and LINE4 in test.go. They can get exit code from batch files. And 'call' command is used for 'exe' files. Thus, go have to better to provide new Command object. For example, out, err := exec.ShellCommand(command).ConbineOutput() This object runs command with "cmd.exe /c call". For unix, it works with "sh -c "
Attachments: