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

testscript: signal or some other way to interrupt running command #195

Closed
ldemailly opened this issue Jan 21, 2023 · 2 comments
Closed

testscript: signal or some other way to interrupt running command #195

ldemailly opened this issue Jan 21, 2023 · 2 comments

Comments

@ldemailly
Copy link

ldemailly commented Jan 21, 2023

I want to be able to test ^C behavior and long running but interruptible programs and not having a pid from & I don't know how to do it

otherwise testscript is near perfect!

# how to do this
dnsping www.google.com 8.8.8.8 &
exec sleep 3
exec kill %1 # this doesn't exist/work - doesn't reference the dnsping sub process above
wait
stderr 'will query until interrupted'
stdout '0 errors \(0.00%\), [34] success.'

right now I found this workaround but it's brittle (relies on the exec being called same as the go command and nothing else being called same - and also doesn't work on ci)

exec pkill -x dnsping # todo want something like kill %1 instead

https://github.com/fortio/dnsping/pull/17/files#diff-c93182c79a5fb9ceb9b9ba653ab9acd3ea10510a75167c5972e3890fa799389bR76

@ldemailly
Copy link
Author

ldemailly commented May 13, 2023

Am I not seeing an existing easy way to achieve this? (got reminded of this reading #228 where setup go side is mentioned but I am also looking for something in txtar)

@mvdan
Copy link
Collaborator

mvdan commented Apr 11, 2024

Let's consolidate under #242, since that issue has an open PR.

@mvdan mvdan closed this as not planned Won't fix, can't repro, duplicate, stale Apr 11, 2024
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

No branches or pull requests

2 participants