Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aaronhuggins/managed-daemon
A wrapper for spawning child processes as managed daemons in Node.
https://github.com/aaronhuggins/managed-daemon
Last synced: 9 days ago
JSON representation
A wrapper for spawning child processes as managed daemons in Node.
- Host: GitHub
- URL: https://github.com/aaronhuggins/managed-daemon
- Owner: aaronhuggins
- Created: 2020-08-06T16:30:20.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-05-07T00:49:14.000Z (over 2 years ago)
- Last Synced: 2024-10-14T03:08:31.016Z (about 1 month ago)
- Language: TypeScript
- Size: 193 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Managed Service Daemon
A wrapper for spawning child processes as managed daemons in Node, with typescript definitions included.
## Usage
Install via [NPM](https://www.npmjs.com/package/managed-service-daemon) and require in your project.
```js
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](./src/Interfaces.ts).