Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when running childrenOfPid when app is exiting #21

Open
majg0 opened this issue Oct 11, 2017 · 2 comments
Open

Crash when running childrenOfPid when app is exiting #21

majg0 opened this issue Oct 11, 2017 · 2 comments

Comments

@majg0
Copy link

majg0 commented Oct 11, 2017

Just had the following crash, and it seems the problem originates here.

  ...
42.  var processLister;
43.  if (process.platform === 'win32') {
  ...
46.  } else {
47.    processLister = spawn('ps', ['-A', '-o', 'ppid,pid,stat,comm']);
  ...
50.  es.connect(
  ...
52.    processLister.stdout, // this is undefined
  ...
TypeError: Cannot read property 'on' of undefined
    at duplex (/Users/mg/w/git/nxt-render/node_modules/duplexer/index.js:31:11)
    at Object.module.exports (/Users/mg/w/git/nxt-render/node_modules/stream-combiner/index.js:8:17)
    at childrenOfPid (/Users/mg/w/git/nxt-render/node_modules/ps-tree/index.js:50:6)
    at kill (/Users/mg/w/git/nxt-render/node_modules/nodemon/lib/monitor/run.js:281:7)
    at Function.run.kill (/Users/mg/w/git/nxt-render/node_modules/nodemon/lib/monitor/run.js:214:9)
    at Bus.<anonymous> (/Users/mg/w/git/nxt-render/node_modules/nodemon/lib/monitor/run.js:346:7)
    at emitOne (events.js:120:20)
    at Bus.emit (events.js:210:7)
    at restartBus (/Users/mg/w/git/nxt-render/node_modules/nodemon/lib/monitor/watch.js:162:7)
    at FSWatcher.filterAndRestart (/Users/mg/w/git/nxt-render/node_modules/nodemon/lib/monitor/watch.js:145:16)
@juliangruber
Copy link

I just saw the same, node docs explains:

The subprocess.stdout property can be null if the child process could not be successfully spawned.

Since this fails synchronously, one should be able to catch it. I'm going to open a PR for this

juliangruber added a commit to juliangruber/ps-tree that referenced this issue Jan 31, 2022
@juliangruber
Copy link

Fix in #52

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants