How to use the process.kill function in process

To help you get started, we’ve selected a few process 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 expo / expo / packages / jest-expo / bin / jest.js View on Github external
// "jest" we use this proxy script.
//
// We forward all arguments and stdio streams to the real "jest" program and exit with the same
// signal or status code.
//
// If you need to run Jest with the JS debugger enabled, run Jest directly. It is usually under
// node_modules/jest/bin/jest.js.
const jestPackageJson = require('jest/package.json');
const jestPackagePath = path.resolve(require.resolve('jest/package.json'), '..');
const jestProgramPath = path.resolve(jestPackagePath, jestPackageJson.bin.jest);
const jestProgramArgs = process.argv.slice(2);
const jestWithArgs = [jestProgramPath].concat(jestProgramArgs);
const result = childProcess.spawnSync('node', jestWithArgs, { stdio: 'inherit' });

if (result.signal) {
  process.kill(process.pid, result.signal);
} else {
  process.exit(result.status);
}
github qooxdoo / qooxdoo-compiler / source / class / qx / tool / cli / commands / Run.js View on Github external
psTree(parentId, function (err, children) {
            if (err) { 
              reject(err);
              return;
            }
            children.forEach(item => {
              try {
                process.kill(item.PID);
              } catch (ex) {
                // Nothing
              }
            });
            try {
              process.kill(parentId);
            } catch (ex) {
              // Nothing
            }
            resolve();
          });
        });
github tgdn / cs261 / frontend / server.js View on Github external
r.table('tasks').get(id).run(conn, (err, task) => {
                 if (!err) {
                     /* verify the task isnt finished and kill process */
                     if (!task.terminated) {
                         process.kill(task.pid)
                     }
                 }
             })
             res.json({ success: true })
github versatica / mediasoup / test / test-Worker.js View on Github external
await new Promise((resolve) =>
	{
		worker.on('died', resolve);

		process.kill(worker.pid, 'SIGKILL');
	});
github versatica / mediasoup / test / test-Worker.js View on Github external
await new Promise((resolve, reject) =>
	{
		worker.on('died', reject);

		process.kill(worker.pid, 'SIGPIPE');
		process.kill(worker.pid, 'SIGHUP');
		process.kill(worker.pid, 'SIGALRM');
		process.kill(worker.pid, 'SIGUSR1');
		process.kill(worker.pid, 'SIGUSR2');

		setTimeout(() =>
		{
			expect(worker.closed).toBe(false);

			worker.close();
			resolve();
		}, 2000);
	});
}, 3000);
github getstation / electron-process-manager / src / ProcessManager.js View on Github external
killProcess(pid) {
    this.emit('will-kill-process', pid, this.window);
    process.kill(pid);
    this.emit('killed-process', pid, this.window);
  }
github expo / expo / packages / expo-yarn-workspaces / bin / expo-yarn-workspaces.js View on Github external
function _spawnSubprocess(...args) {
  let result = spawnSync(...args);

  if (result.signal) {
    process.kill(process.pid, result.signal);
  }

  if (result.status) {
    process.exit(result.status);
  }
}
github tuxedocomputers / tuxedo-fan-control / src / common / daemon.ts View on Github external
export function stop(): void
{
    if(fs.existsSync(System.PID_FILE_PATH))
    {
        let daemonPid: number = Number(fs.readFileSync(System.PID_FILE_PATH).toString());

        try
        {
            process.kill(daemonPid, "SIGINT");
            fs.unlinkSync(System.XLOCK_FILE);
        }
        catch (error)
        {
            fs.writeFileSync(System.LOGFILE_PATH_DAEMON, "Error at stop daemon, error: " + error + "\n", { flag: "a" });
        }

        fs.unlinkSync(System.PID_FILE_PATH);

        setAutoFanDuty(5);
    }
}
github APerricone / harbourCodeExtension / client / src / debugger.js View on Github external
harbourDebugSession.prototype.terminateRequest = function(response, args)
{
	process.kill(this.processId,'SIGKILL');
	this.sendResponse(response);
}