Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
DennisMao opened this issue Jan 10, 2018 · 5 comments
Closed

Comments

@DennisMao
Copy link

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

@odeke-em odeke-em changed the title os/exec: exec.command().output() can not receive contents from stdout on Server 2008 os/exec: CombinedOutput() cannot receive contents from stdout on Server 2008 Jan 10, 2018
@odeke-em
Copy link
Member

@as
Copy link
Contributor

as commented Jan 10, 2018

What is tts.exe? Can you retry with a well known command like:

cmd := exec.Command("ping", "localhost")

@DennisMao
Copy link
Author

@as i have tried common commands,it works. tts.exe is an example executed file,which written in C++.

@as
Copy link
Contributor

as commented Jan 10, 2018

@DennisMao can you post the output go go env and the windows ver command?

@DennisMao
Copy link
Author

@as thanks for you guidance,i find the reason that the standard output cannot be redirected on Server 2008 as the secure policy. Issue closed

@golang golang locked and limited conversation to collaborators Jan 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants