Project

General

Profile

action #160820

Updated by tinita 3 months ago

https://progress.opensuse.org/issues/160820 

 openqa-cli: Do not read from STDIN unless explicitly requested size:S 

 ## Motivation Observation 

 See #160628-9 https://progress.opensuse.org/issues/160628#note-9 

 A shell script called via `bash < ...` called openqa-cli, and that was reading STDIN, making it empty, and the rest of the bash script was skipped because bash didn't get any more input lines. 

 In some cases it might be handy to read from STDIN unrequested, e.g. linters, where it's obvious that they either take a file / dir or STDIN. 
 But for openqa-cli it was a bit unexpected, and in a context where that data from STDIN wasn't actually used. 

 It might break things, but still a good idea to add an explicit flag to read from STDIN to prevent confusing implicit behaviour. 

 ## Acceptance criteria 
 * **AC1:** openqa-cli no longer reads from STDIN without a flag being set 

 ## Suggestions 
 * Read https://github.com/os-autoinst/openQA/blob/master/script/openqa-cli, in particular `data_from_stdin` in https://github.com/os-autoinst/openQA/blob/master/lib/OpenQA/Command.pm#L33 
 * Consider adding a command line parameter, e.g. `--non-interactive`, or detect the calling scope or `-i -` to explicitly read STDIN and not doing it otherwise 
 * Find out in what cases the client needs to read from STDIN and decide how to call the flag based on that 
 * Check whether curl has a similar flag and use consistent naming 






 STDIN.

Back