JSPM

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

Process spawning APIs beautified

Package Exports

  • sb-exec

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 (sb-exec) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Exec

Node's Process spawning APIs beautified

Installation

npm install --save sb-exec

API

type $Options = {
  timeout?: number | Infinity,
  stream?: 'stdout' | 'stderr'  | 'both',
  env: Object,
  stdin?: ?string,
  local?: {
    directory: string,
    prepend?: boolean
  },
  throwOnStdErr?: boolean = true,
  allowEmptyStderr?: boolean = false,
  ignoreExitCode?: boolean
} // Also supports all options of child_process::spawn
export function exec(filePath: string, parameters: array, options: $Options)
export function execNode(filePath: string, parameters: array, options: $Options)

Explanation

options.local

options.local is a way of adding locally installed npm bins to PATH of the process being spawned. Please have a look at the program structure below.

If the control of your program is in lib/index.js and you pass that directory to this module ( like { local: { directory: __dirname } } ), then the flow executable in node_modules/.bin/flow will automatically be added to PATH.

If the control of your program is in node_modules/flow/index.js and you pass that directory as the local directory, both the flow and freedom executables will be available to the program being executed.

options.local.prepend determines the priority of the local bins, if set to true, local ones will be prioritized over global ones, otherwise they'll be treated as a fallback.


.
├── lib
│   └── index.js
└── node_modules
    ├── .bin
    │   └── flow
    └── flow
        ├── index.js
        └── node_modules
            ├── .bin
            │   └── freedom
            └── freedom
                └── index.js

License

This project is licensed under the terms of MIT License, see the LICENSE file for more info