Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ionic/utils-process

Package Overview
Dependencies
Maintainers
24
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ionic/utils-process

Process utils for NodeJS

  • 2.1.8
  • Source
  • npm
  • Socket score

Version published
Maintainers
24
Created

What is @ionic/utils-process?

@ionic/utils-process is a utility library for handling various process-related tasks in Node.js. It provides functions for managing subprocesses, handling signals, and other process-related utilities.

What are @ionic/utils-process's main functionalities?

spawn

The `spawn` function is used to create a new subprocess. In this example, it runs the `ls -la` command and logs the result.

const { spawn } = require('@ionic/utils-process');

async function runCommand() {
  const result = await spawn('ls', ['-la']);
  console.log(result);
}

runCommand();

onExit

The `onExit` function is used to handle the exit event of a subprocess. In this example, it monitors a subprocess running a simple Node.js script and logs a message when the process exits.

const { onExit } = require('@ionic/utils-process');

async function monitorProcess() {
  const child = require('child_process').spawn('node', ['-e', 'console.log("Hello World")']);
  await onExit(child);
  console.log('Process exited');
}

monitorProcess();

killProcessTree

The `killProcessTree` function is used to terminate a process and all of its child processes. In this example, it terminates the process with the given PID and logs a message.

const { killProcessTree } = require('@ionic/utils-process');

async function terminateProcess(pid) {
  await killProcessTree(pid);
  console.log(`Process ${pid} and its children have been terminated`);
}

terminateProcess(12345);

Other packages similar to @ionic/utils-process

FAQs

Package last updated on 29 Sep 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc