包详细信息

runscript

node-modules174.5kMIT2.0.1

Run script easy!

runscript, run-script, npm run

自述文件

runscript

📢📢📢📢📢 You should use execa instead. 📢📢📢📢


NPM version Node.js CI Test coverage npm download

Run script easy!

Installation

npm install runscript

Quick start

Commonjs

const { runScript } = require('runscript');

runScript('node -v', { stdio: 'pipe' })
  .then(stdio => {
    console.log(stdio);
  })
  .catch(err => {
    console.error(err);
  });

ESM & TypeScript

import { runScript } from 'runscript';

runScript('node -v', { stdio: 'pipe' })
  .then(stdio => {
    console.log(stdio);
  })
  .catch(err => {
    console.error(err);
  });

run with timeout

Run user script for a maximum of 10 seconds.

const { runScript } = require('runscript');

runScript('node user-script.js', { stdio: 'pipe' }, { timeout: 10000 })
  .then(stdio => {
    console.log(stdio);
  })
  .catch(err => {
    console.error(err);
  });

Upgrade from 1.x to 2.x

// 1.x
// const runscript = require('runscript');

// 2.x
const { runscript } = require('runscript');

License

MIT

Contributors

Contributors

Made with contributors-img.

更新日志

Changelog

2.0.1 (2024-12-10)

Bug Fixes

2.0.0 (2024-12-09)

⚠ BREAKING CHANGES

  • drop Node.js < 14.0.0 support

part of https://github.com/eggjs/egg/issues/3644

Features

  • support cjs and esm both by tshy (#23) (eb81077)

1.6.0 (2024-01-11)

Features

1.5.4 (2024-01-11)

Bug Fixes


1.5.3 / 2022-05-20

fixes

others

1.5.2 / 2022-03-08

fixes

others

1.5.1 / 2021-05-07

fixes

others

1.5.0 / 2020-05-22

features

1.4.0 / 2019-07-06

features

1.3.1 / 2019-06-15

fixes

others

1.3.0 / 2017-07-28

  • feat: support relative path on windows (#5)

1.2.1 / 2017-02-22

  • fix: exit code < 0 as error too (#3)

1.2.0 / 2017-02-04

  • feat: add options stdout and stderr (#2)

1.1.0 / 2016-03-06

  • feat: support return stdio

1.0.0 / 2016-02-05

  • First release