managed-service-daemon
v1.2.1
Published
A wrapper for spawning child processes as managed daemons in Node.
Downloads
5
Maintainers
Readme
Managed Service Daemon
A wrapper for spawning child processes as managed daemons in Node, with typescript definitions included.
Usage
Install via NPM and require in your project.
const gulp = require('gulp')
const shell = require('gulp-shell')
const { Service } = require('managed-service-daemon')
const workingDir = './.azurite'
const azuriteBlob = new Service({
name: 'azuriteBlob',
command: 'node',
args: [path.normalize('./node_modules/azurite/dist/src/blob/main'), '-s', '-l', workingDir],
startWait: 500,
onStart: () => fs.mkdirSync(workingDir),
onStop: () => fs.rmdirSync(workingDir, { recursive: true })
})
exports.mocha = async function mocha () {
return shell.task(['mocha'], { ignoreErrors: true })()
}
exports.test = gulp.series(azuriteBlob.start, exports.mocha, azuriteBlob.stop)
The Service options also accept all non-overlapping child_process.spawn
options; overlapping options would include stdio
, for example.
Aditional options specific to the Service class can be viewed in the TypeScript code.