processes started via `exec` are unable to accept input
See original GitHub issueIf I try to launch npm init
from a shelljs script it seems that the stdin is not passed through to that process:
require('shelljs/global')
exec('npm init')
=>
exec npm init { stdio: 'inherit' }
This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sensible defaults.
See `npm help json` for definitive documentation on these fields
and exactly what they do.
Use `npm install <pkg> --save` afterwards to install a package and
save it as a dependency in the package.json file.
Press ^C at any time to quit.
name: (drive) foobar
Pressing enter has no effect.
Issue Analytics
- State:
- Created 7 years ago
- Comments:13 (7 by maintainers)
Top Results From Across the Web
kubectl exec fails with the error "Unable to use a TTY - input is ...
kubernetes - kubectl exec fails with the error "Unable to use a TTY - input is not a terminal or the right kind...
Read more >Got "input output error" when execute any commands
I found my server can't run any command, and it shouws "input output error". The error code EIO ("Input/output error") on command launch ......
Read more >Process (Java Platform SE 8 ) - Oracle Help Center
The ProcessBuilder.start() and Runtime.exec methods create a native process and return an instance of a subclass of Process that can be used to...
Read more >How to read user input during boot stage with systemd in Linux
Shell script to read user input during boot stage in Linux with a systemd service in CentOS/RHEL 7/8 Linux. Take input at the...
Read more >FIO07-J. Do not let external processes block on IO buffers
A process that tries to read input on an empty input stream will block until ... This noncompliant code example invokes notemaker using...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Confirmed as a bug.
As a workaround, please use
child_process.execSync('npm init', {stdio: 'inherit'});
Fixes are welcomed.
Oh right. I’ve noticed that for some reason transient output like npm’s progress bar works when I use
inherit
but not when I do something like the above (or better, doc.stdout.pipe(process.stdout)
). I haven’t figured out why that is. But it might be nice to have an option to useinherit
and not capture output for that purpose.