question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

processes started via `exec` are unable to accept input

See original GitHub issue

If 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:open
  • Created 7 years ago
  • Comments:13 (7 by maintainers)

github_iconTop GitHub Comments

19reactions
nfischercommented, Apr 14, 2016

Confirmed as a bug.

As a workaround, please use child_process.execSync('npm init', {stdio: 'inherit'});

Fixes are welcomed.

2reactions
jedwards1211commented, Sep 7, 2016

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, do c.stdout.pipe(process.stdout)). I haven’t figured out why that is. But it might be nice to have an option to use inherit and not capture output for that purpose.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found