0

This question is essentially the exact duplicate of this question, but that is a 2+ year old question and hasn't been properly answered yet.

How do I get the stdin/stdout of an existing running process that Node.js didn't spawn with child_process (or has spawned it with child_process, but let it run detached (and then stopped/crashed, and had to restart))?

Community
  • 1
  • 1
Ivan
  • 307
  • 1
  • 16
  • This is going to be pretty platform specific. Here's one solution for Linux, using a 3rd party program (reptyr) - http://stackoverflow.com/questions/9047581/capture-stdin-stderr-stdout-of-a-process-after-its-been-started-using-comm – Joe Jan 11 '14 at 03:29
  • @Joe well, is there a way to do it that doesn't use 3rd party programs? That's what I'm looking for, after all. – Ivan Jan 11 '14 at 03:30
  • Well, you can look at the code in there for ideas. What you're describing is not that easy to do. https://github.com/nelhage/reptyr It depends on ptrace, which might not work for your purposes. – Joe Jan 11 '14 at 03:32
  • @Joe Well, I guess I might as well use reptyr for now. Thanks anyway. – Ivan Jan 11 '14 at 03:34

0 Answers0