posix_spawn

Binding to posix_spawn

Usage no npm install needed!

<script type="module">
  import posixSpawn from 'https://cdn.skypack.dev/posix_spawn';
</script>

README

posix_spawn

This module binds posix_spawn() to nodejs. This module aims to become a drop-in replacement for child_process, as child_process relies on fork() and, thus, requires enough free memory to spawn child processes. (cf. Node Issue #25382)

API

const childProcess = require('posix_spawn');

Method: exec()

childProcess.exec(cmd[, options], [(err, rc, stdout, stderr) => {}])

Executes cmd with /bin/sh. When the child process exits, the callback function will be called: rc is a number hand holds the return code. stdout and stderr are Buffer and hold the data the child wrote into the respective pipe.