JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4167078
  • Score
    100M100P100Q269838F
  • License MIT

Actions exec lib

Package Exports

  • @actions/exec
  • @actions/exec/lib/exec
  • @actions/exec/lib/exec.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@actions/exec) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@actions/exec

Usage

Basic

You can use this package to execute tools in a cross platform way:

const exec = require('@actions/exec');

await exec.exec('node index.js');

Args

You can also pass in arg arrays:

const exec = require('@actions/exec');

await exec.exec('node', ['index.js', 'foo=bar']);

Output/options

Capture output or specify other options:

const exec = require('@actions/exec');

let myOutput = '';
let myError = '';

const options = {};
options.listeners = {
  stdout: (data: Buffer) => {
    myOutput += data.toString();
  },
  stderr: (data: Buffer) => {
    myError += data.toString();
  }
};
options.cwd = './lib';

await exec.exec('node', ['index.js', 'foo=bar'], options);

Exec tools not in the PATH

You can specify the full path for tools not in the PATH:

const exec = require('@actions/exec');

await exec.exec('"/path/to/my-tool"', ['arg1']);