Skip to content
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

exec.CommandContext is invalide #25066

Closed
better0332 opened this issue Apr 25, 2018 · 3 comments
Closed

exec.CommandContext is invalide #25066

better0332 opened this issue Apr 25, 2018 · 3 comments

Comments

@better0332
Copy link

Please answer these questions before submitting your issue. Thanks!
exec.CommandContext is invalide

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

go 1.10.1

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/root/go"
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build487130894=/tmp/go-build -gno-record-gcc-switches"

What did you do?

https://play.golang.org/p/Ya4haCk5_P7

What did you expect to see?

exit context timeout 2 sec

What did you see instead?

exit sleep 10 end

@ianlancetaylor
Copy link
Contributor

This is another version of #23019. In this case the child process is the shell and the grandchild process is the sleep. Killing the shell does not kill the sleep, so the parent waits for the grandchild to exit in order to complete collecting all output. Closing as duplicate.

@diekmann
Copy link

diekmann commented May 2, 2018

The context doc describes "Calling the CancelFunc cancels the child and its children". Thinking of this in UNIX terminology (child == child process), the actual behavior (not killing the child process' children processes) is very misleading.

@ianlancetaylor
Copy link
Contributor

@diekmann This issue is closed. I suggest that you comment on other issues.

In the doc you are quoting, "its children" refers to the child contexts, not the child processes. That doc doesn't discuss processes at all.

@golang golang locked and limited conversation to collaborators May 2, 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