xrtlibrary-processutilities

Process utilities module of XRT library.

Usage no npm install needed!

<script type="module">
  import xrtlibraryProcessutilities from 'https://cdn.skypack.dev/xrtlibrary-processutilities';
</script>

README

# XRTLibrary-ProcessUtilities

Introduction

This library contains several process utilities.

Installation

To install this package, you can use NPM by typing following command:

npm install xrtlibrary-processutilities --save

Then you can import this library in your JavaScript code:

const XRTLibProcessUtilities = require("xrtlibrary-processutilities");

Examples

Download this package and see the "examples" directory.

APIs

IsProcessRunning(pid)

Check whether a process is running.

Parameter(s):

  • pid (Number): The process ID.

Return value:

  • (Boolean): True if so.

WaitForChildProcess(cp, [cancellator])

Wait for specified child process.

Parameter(s):

  • cp (ChildProcess): The child process.
  • cancellator (ConditionalSynchronizer): (Optional) The cancellator.

Return value:

  • (Promise<{code: ?Number, signal: ?String}>): The promise object (resolves with the exit information, rejects when cancelled or error occurred).

IsChildProcessExited(cp)

Check whether a child process was exited.

Parameter(s):

  • cp (ChildProcess): The child process.

Return value:

  • (Boolean): True if so.