execute-command-sync
Execute console commands synchronously in Node.js.
Last updated 2 years ago by allnulled .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install execute-command-sync 
SYNC missed versions from official npm registry.

execute-command-sync

1. Introduction

This is a module for Node.js that will let you run console commands redirecting the input, output and error streams, directly to the console, and also in synchronous code.

2. Installation

Download the repository from NPM. To do it, type from the command line:

~$ npm install -s execute-command-sync

Import in your code the module:

const executeCommand = require("execute-command-sync");

3. Usage

Start using the command like this:

  executeCommand("ls -lA", {cwd:"/"});
  // You can do things here after the execution has finished
  // The results will be logged in the console

Take into account that the output, the error and the input streams are not catchable. To do this, there are more advanced packages out there, like this one: exec-plan.

4. Conclusion

This module is just a wrapper for this answer at StackOverflow:

Use child_process.execSync but keep output in console

Thanks to the great developers that are on StackOverflow, helping every day to do our life a bit easier. Their wisdom is always an honor.

Current Tags

  • 1.0.2                                ...           latest (2 years ago)

3 Versions

  • 1.0.2                                ...           2 years ago
  • 1.0.1                                ...           3 years ago
  • 1.0.0                                ...           3 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (0)
None

Copyright 2014 - 2016 © taobao.org |