Skip to main content

tools-shell

Build npm version

@rnx-kit/tools-shell is a collection of functions for writing shell scripts.

You can import the entire package, or, to save space, import individual categories:

import * as tools from "@rnx-kit/tools-shell";

// Alternatively...
import * as asyncTools from "@rnx-kit/tools-shell/async";
import * as commandTools from "@rnx-kit/tools-shell/command";
CategoryFunctionDescription
asyncidle(ms)Sleep for a specified numer of milliseconds.
asynconce(func)Wraps the function, making sure it only gets called once.
asyncretry(func, retries, counter)Calls the specified function, retrying up to specified number of times as long as the result is null.
asyncwithRetry(func, retries, counter)Calls the specified function, retrying up to specified number of times as long as the function throws.
commandensure(result, message)Throws if the result of the process is non-zero.
commandensureInstalled(check, message)Throws if the provided command fails.
commandmakeCommand(command, userOptions)Creates an async function for calling the specified command.
commandmakeCommandSync(command)Creates a synchronous function for calling the specified command.