mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-12-23 22:27:34 -05:00
e83e500b80
* fix: lint warnings * fix: test
20 lines
657 B
TypeScript
20 lines
657 B
TypeScript
/* eslint-disable prefer-promise-reject-errors */
|
|
import { fork } from 'child_process';
|
|
|
|
export function spawnRegistry(verdaccioPath: string, args: string[], childOptions) {
|
|
return new Promise((resolve, reject) => {
|
|
let _childOptions = { silent: true, ...childOptions };
|
|
|
|
const childFork = fork(verdaccioPath, args, _childOptions);
|
|
|
|
childFork.on('message', (msg: {verdaccio_started: boolean}) => {
|
|
if (msg.verdaccio_started) {
|
|
resolve(childFork);
|
|
}
|
|
});
|
|
|
|
childFork.on('error', (err) => reject([err]));
|
|
childFork.on('disconnect', (err) => reject([err]));
|
|
childFork.on('exit', (err) => reject([err]));
|
|
});
|
|
}
|