It makes more sense to use a complete line as input.
There are two possible exit codes. 1 if you use sandbox and it fails to read the device file. 0 if you --no-sandbox. Which is why I'm using pipe_output.
Oh, and `pipe_output("bash -c 'blah blah'", "y\n")` is much less understandable as far as I am concerned. I know what `yes` commonly does. I don't know what the heck `y\n` is.
Because a typical use of pipe_output concerns a test command that can handle any input, or at least a class of input. You specify one (usually simple) input and check the output. Here, there's only one input that makes any sense at all.
I think `shell_output` makes much more sense here, because you should treat the entire thing as a test command, rather than, this part is the test command, that part is the input we feed into it (a y to answer a prompt...).