actions.run[shell]-with-tty?

39 views
Skip to first unread message

Robert Cauble

unread,
Sep 19, 2022, 4:59:52 PM9/19/22
to bazel-discuss
Hi All,

Is there any sort of option for actions.run/actions.run_shell to inherit the tty of the caller?

This is in the context of a migration from maven and one of our sub-modules is a dockerized build. The behavior I see from docker is that unless you run with "-it" then if the user kills the build with Ctrl+C, the docker container continues running until the build finishes. With maven I was able to use <inheritIO> in the exec plugin which allowed "docker run -it" which gave the desired behavior that Ctrl+C kills the build within docker. 

Wondering if there's a similar option in bazel.

Thanks,
Rob

Alex Eagle

unread,
Sep 19, 2022, 7:13:05 PM9/19/22
to bazel-discuss
There isn't an option to pass through the tty, but of course you can just attach a dummy one to stdin of the process you spawn. I was working on this in https://github.com/aspect-build/rules_swc/pull/57/commits/c700247e9cf9b506e23ce217da10f4e97c6332cd but got pulled away.

Robert Cauble

unread,
Sep 20, 2022, 1:14:29 PM9/20/22
to Alex Eagle, bazel-discuss
Thanks, I tinkered around with trying to fake out the tty but no luck. I think for it to work, I need to relay the CTRL+C event all the way into the build running within docker. And I don't think that works with a fake tty. 

Really this is a limitation of docker that it doesn't have a way to automatically shutdown when the parent process dies. It's just that I was able to workaround this in maven but not bazel.

--
You received this message because you are subscribed to the Google Groups "bazel-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-discuss/75dd483f-862e-40b7-b909-d8e2398b0ee2n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages