Skip to content

os/exec: CombinedOutput() cannot receive contents from stdout on Server 2008 #23397

@DennisMao

Description

@DennisMao

What version of Go are you using (go version)?

go version go1.8 windows/amd64

What did you do?

run executable binary and receive the message after execution from stdout on Server2008.

What did you expect to see?

excpect output: SUCCESS=0 or FAILED=1 (user-defined)

What did you see instead?

it runs normally on Win7 & Win10.
it runs exec.command() normally on Server 2008 (64bit) .
but i can not receive the return message from stdout.
otherwise,it can normally print the message when using the CMD
1515566478 1

I have try to bind a bytes.Buffer to the stdout,and call Run() .But it still nothing to receive.

cmd := exec.Command()
var buf bytes.buffer
cmd.Stdout = &buf   //  catched nothing 

test code :

package main

import (
	"log"
	"os/exec"
)

func main() {
	cmd := exec.Command("tts", "hello", "D:/test.wav")
	buf, err := cmd.CombinedOutput()
	if err != nil {
		log.Println("failed:", err)
		return
	}
	log.Println("success:", string(buf))
}

print log:
run on win7 & win10

SUCCESS=0

run on Server 2008

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions