Closed harluss closed 2 years ago
You need to enable stdin (to get user input), stdout (to show the echos), and stderr (to show the prompt for read). Try this:
- shell:
- description: 'Checking App Store signin'
command: scripts/appstore.zsh
stdin: true
stdout: true
stderr: true
Ah, ok. I had stdout
and stderr
enabled through defaults, but completely missed stdin
.
It worked like a charm, thank you.
I have a script asking user to sign into App Store:
When executed directly (by itself) in the terminal, it will prompt
Open App Store? [y/n]
and wait for user's input. But when executed as part ofinstall.conf.yaml
, like this:It will display the first echo, then go into infinite loop ignoring everything inside, including the
read
line.I have tried it the bash way as well i.e.
read -r -p "Open App Store? [y/n] :" answer
but it still goes into infinite loop and throws an error as-p
in zsh works differently than in bash. I have tried theread
command without the loop and it's completely ignored when the script is executed as part ofinstall.conf.yaml
, but again works as expected when I execute the script manually.Any idea why?