Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@fcostarodrigo/exec

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fcostarodrigo/exec

Wrapper around node spawn process

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Exec

Wrapper around node spawn process to make it easier to use.

Features

Promises

Command is converted to a promise.

const result = await exec("echo Hello World!");
console.log(result); // Hello World!

Command parser

Spaces are trimmed.

const result = await exec("echo Hello     World!");
console.log(result); // Hello World!

Quotes and double quotes can be used to don't trim spaces.

const result = await exec("echo 'Hello     World!'");
console.log(result); // Hello     World!

Other arguments are take literally.

const result = await exec("echo", "Hello     World!");
console.log(result); // Hello     World!

You can use array of strings to make it easier to read.

await exec("program", { env: {} }, [
  ["--option", "value"],
  ["--option", "value"],
  ["--option", "value"],
]);

Other options

  • printCommand: Print command before running it.
  • inherit: Send output directly to the terminal. Some programs will work on "CI" mode if terminal's stdio is not inherited.
  • spinner: Display a spinner while the command is running.
  • spawnOptions: Override options sent to spawn.
  • proxy: Set proxy environment variables to this value.
  • retries: Retry running command on error.
  • timeout: Fail command on timeout.
  • ignoreError: Never rejects returning promise.
  • stdin: Send text like the character y to the program.
  • printOutput: When not inheriting stdio, send output from the program to the terminal.

Changelog

Changelog

License

MIT License

Keywords

FAQs

Package last updated on 14 Apr 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc