
Security News
Another Round of TEA Protocol Spam Floods npm, But It’s Not a Worm
Recent coverage mislabels the latest TEA protocol spam as a worm. Here’s what’s actually happening.
observable-process
Advanced tools
High-level support for running, observing, and interacting with child processes in Node.js
High-level support for running, observing, and interacting with child processes in Node.js 4 and above.
const ObservableProcess = require('observableProcess')
var myProcess = new ObservableProcess('echo hello')
myProcess.on('ended', function ({exitCode}) {
// ...
})
You can also provide the process to run as an argv array:
myProcess = new ObservableProcess(['echo', 'hello'])
myProcess = new ObservableProcess('echo hello', { cwd: '~/tmp' })
myProcess = new ObservableProcess('echo hello', { env: { foo: 'bar' } })
ObservableProcess provides powerful mechanisms to work with output
generated by the subprocess.
By default, the output of the observed process is printed on the console.
You can also customize logging by providing custom stdout and stderr objects
(which needs to have the method write):
const myStdOut = {
write: (text) => {
// ...
}
}
const myStdErr = {
write: (text) => {
// ...
}
}
myProcess = new ObservableProcess('echo hello', { stdout: myStdOut, stderr: myStdErr })
You can use dimConsole to print output from the subshell dimmed, so that it is easy to distinguish from output of the main thread.
const dimConsole = require('dim-console')
myProcess = new ObservableProcess('echo hello', { stdout: dimConsole.stdout, stderr: dimConsole.stderr })
To get more detailed output like lifecycle events of the subshell in the error stream:
myProcess = new ObservableProcess('echo hello', { verbose: true })
You can retrieve the output that has accumulated so far to stdout and stderr
merged into a single string:
myProcess.fullOutput() // returns all the output produced by the subprocess so far
You can be notified when the process prints given text on stdout or stderr.
This is useful for waiting until slow-starting services are fully booted up.
myProcess.waitForText('listening on port 3000').then(function () {
// this method runs after the process prints "listening on port 3000"
})
To disable output altogether:
myProcess = new ObservableProcess('my-server', { stdout: null, stderr: null })
You can enter text into the running process via:
myProcess.enter('text')
If the process is running, you can kill it via:
myProcess.kill()
This sets the killed property on the ObservableProcess instance,
so that manual kills can be distinguished from crashes.
To let ObservableProcess notify you when a process ended:
myProcess.waitForEnd(({exitCode, killed}) => {
// the process has ended here
})
You can also access the exit code from the process object:
myProcess.exitCode
myProcess.pid()
FAQs
High-level support for running, observing, and interacting with child processes in Node.js
The npm package observable-process receives a total of 53 weekly downloads. As such, observable-process popularity was classified as not popular.
We found that observable-process demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Recent coverage mislabels the latest TEA protocol spam as a worm. Here’s what’s actually happening.

Security News
PyPI adds Trusted Publishing support for GitLab Self-Managed as adoption reaches 25% of uploads

Research
/Security News
A malicious Chrome extension posing as an Ethereum wallet steals seed phrases by encoding them into Sui transactions, enabling full wallet takeover.