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

Make sure ctx being cancelled actually stops system() process #124

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

benhoyt
Copy link
Owner

@benhoyt benhoyt commented May 24, 2022

This is a manifestation of golang/go#21922 - use pipes to fix it. Tricky!

Fixes #122.

benhoyt added 5 commits May 22, 2022 21:10
This is an issue with the (grand)child process holding stdout/stderr,
so per golang/go#21922 (comment)
use a pipe to work around this.
Still has some kind of race condition ... not sure why:

$ go test ./interp -awk='' -run='Interp/system.*echo_foo' -count=1000
--- FAIL: TestInterp (0.01s)
    --- FAIL: TestInterp/BEGIN_{_print_system("echo_foo");_print_system("echo_bar")_}__#_!fuzz (0.00s)
        interp_test.go:879: expected "foo\n0\nbar\n0\n", got "0\nbar\n0\n"
--- FAIL: TestInterp (0.01s)
    --- FAIL: TestInterp/BEGIN_{_print_system("echo_foo");_print_system("echo_bar")_}__#_!fuzz (0.00s)
        interp_test.go:879: expected "foo\n0\nbar\n0\n", got "0\nbar\n0\n"
FAIL
FAIL	github.com/benhoyt/goawk/interp	5.241s
FAIL
@benhoyt benhoyt marked this pull request as draft March 25, 2024 07:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cancelling ctx in system() doesn't actually stop it
1 participant