How to use tree-kill - 10 common examples

To help you get started, we’ve selected a few tree-kill examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SwissRealCoin / src-token / tools / server / runner.js View on Github external
const tests = getTests();

            for (let i = 0; i < tests.length; i++) {
                const test      = tests[i];
                const server    = spawnServer();

                listen(server);

                log.info('Running test ' + (i + 1) + ' of ' + tests.length);

                spawnSync('truffle test ' + test + ' --network develop', {
                    stdio: 'inherit',
                    shell: true
                });

                kill(server.pid);

                if (i < (tests.length - 1)) {
                    await sleep(1000);
                }
            }
            break;
        case 'coverage':
            // @TODO: refactor SolCover + pull request + start coverage task without provided TestRPC (user our own Ganache Server)

            // remove build folder, otherwise the result of code coverage might not be correct
            sh.rm('-fr', './build');

            spawnSync('solidity-coverage', {
                stdio: 'inherit',
                shell: true
            });
github DevExpress / testcafe / src / runner / tested-app.js View on Github external
        const killPromise = new Promise(resolve => kill(this.process.pid, 'SIGTERM', resolve));
github validitylabs / hopr / tools / server / runner.js View on Github external
function cleanExit() {
    if (!dead) {
        log.info(process.pid);
        log.info('Clean up all (sub) processes');

        kill(process.pid, 'SIGTERM', (err) => {
            if (arguments.length > 0) {
                log.info('tree kill callback arguments:');
                log.info(arguments.toString());
            }
            if (err) {
                log.error(err);
            }
        });

        dead = true;
    }
}
github SwissRealCoin / src-token / tools / server / runner.js View on Github external
function cleanExit() {
    if (!dead) {
        log.info('PID main process: ' + process.pid);
        log.info('Clean up all (sub) processes');

        kill(process.pid, 'SIGTERM', (err) => {
            if (arguments.length > 0) {
                log.info('tree kill callback arguments:');
                log.info(arguments);
            }

            if (err) {
                log.error(err);
            }
        });

        dead = true;
    }
}
github smooth-code / jest-puppeteer / packages / spawnd / src / index.js View on Github external
function cleanExit(code = 1) {
    if (proc && proc.pid) {
      treeKill(proc.pid, () => exit(code))
    } else {
      exit(code)
    }
  }
github bennymeg / nx-electron / src / builders / execute / execute.impl.spec.ts View on Github external
it('should log errors from killing the process', async done => {
    treeKill.mockImplementation((pid, signal, callback) => {
      callback(new Error('Error Message'));
    });
    const loggerError = spyOn(context.logger, 'error');
    scheduleTargetAndForget = scheduleTargetAndForget.and.returnValue(
      from([
        { success: true, outfile: 'outfile.js' },
        { success: true, outfile: 'outfile.js' }
      ])
    );
    electronExecuteBuilderHandler(testOptions, context).subscribe({
      complete: () => {
        expect(loggerError.calls.argsFor(1)).toEqual(['Error Message']);
        done();
      }
    });
  });
github GDJiaMi / jm-cli / src / cmds / start.ts View on Github external
function openByElectron(argv: StartOption, prevProcess?: ch.ChildProcess, onRestart?: () => void) {
  if (prevProcess && prevProcess.kill) {
    try {
      restartingElectron = true
      kill(prevProcess.pid, 'SIGKILL')
      setTimeout(() => {
        restartingElectron = false
      }, 5000)
    } catch (err) {
      message.error(`failed to kill electron process: ${err.message}`)
    }
  }

  const DefaultPort = 5858
  const args = [
    argv.electronInspectBrk != null
      ? `--inspect-brk=${argv.electronInspectBrk || DefaultPort}`
      : argv.electronInspect != null
      ? `--inspect=${argv.electronInspect || DefaultPort}`
      : '',
    '.',
github alanzanattadev / atom-molecule-dev-environment / lib / ExecutionControlEpic / TaskExecutionFeature / Model / TasksController.js View on Github external
killTask(execution: TaskExecution) {
    if (execution.process.pid) {
      kill(execution.process.pid);
    }
  }
github Izhaki / nodemon-webpack-plugin / features / support / webpackLauncher.js View on Github external
this.simulateCtrlC = () => {
        kill(this.childProcess.pid, 'SIGINT');
    };
});

tree-kill

kill trees of processes

MIT
Latest version published 5 years ago

Package Health Score

71 / 100
Full package analysis