I need to run a command in CircleCI that will pass predetermined arguments to a following command. When the command only expects strings or integers it works fine to use:
printf "arg1\narg2\n" | my_command
But if "my command" expects a user to use arrow keys to select an option followed by the return key this method fails.
Here is an example of what I am describing:
? Which variation would you like to apply? (Use arrow keys)
❯ A
B
C
So I tried another option, having found a nifty tool called yes:
yes | my_command
This will actually work (and selects option A), but it results in a failed build in CircleCI due to the exit code 141. From what I understand, that exit code happens because yes is still sending input to a process that has exited.
Is there another way I can accomplish?
(yes || true) | my_command
This way you ignore the result code from yes but preserve the result code from my_command.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With