chrisa / node-dtrace-provider

Native DTrace probes for node.js apps
Other
319 stars 70 forks source link

Use dtrace to attach to another process, then exit #116

Closed ORESoftware closed 6 years ago

ORESoftware commented 6 years ago

Support question here -

I am wondering if dtrace can "attach" to another process with pid x...then dtrace will exit, or get some signal, when the other process with pid x dies.

is something like that possible?

at the moment, I can use tail/lsof commands, but those use polling and that's no bueno. I'd like to potentially use something that doesn't involve polling, if possible.

melloc commented 6 years ago

@ORESoftware dtrace(1M) has a -p flag that takes a pid. When the process (or processes if several are specified) exit, then it will exit.

You could also use proc:::exit and call exit() when the pid matches.

Also, there's a DTrace mailing list which is better suited for these kinds of questions, as it has many more subscribers than this repository does.

I hope this helps!