{ "_args": [ [ { "raw": "execa@^0.7.0", "scope": null, "escapedName": "execa", "name": "execa", "rawSpec": "^0.7.0", "spec": ">=0.7.0 <0.8.0", "type": "range" }, "/Volumes/2009-SSD/GT2/GT2-iOS/node_modules/os-locale" ] ], "_from": "execa@>=0.7.0 <0.8.0", "_id": "execa@0.7.0", "_inCache": true, "_location": "/execa", "_nodeVersion": "4.8.3", "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/execa-0.7.0.tgz_1497045041009_0.3423430174589157" }, "_npmUser": { "name": "sindresorhus", "email": "sindresorhus@gmail.com" }, "_npmVersion": "2.15.11", "_phantomChildren": {}, "_requested": { "raw": "execa@^0.7.0", "scope": null, "escapedName": "execa", "name": "execa", "rawSpec": "^0.7.0", "spec": ">=0.7.0 <0.8.0", "type": "range" }, "_requiredBy": [ "/os-locale" ], "_resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz", "_shasum": "944becd34cc41ee32a63a9faf27ad5a65fc59777", "_shrinkwrap": null, "_spec": "execa@^0.7.0", "_where": "/Volumes/2009-SSD/GT2/GT2-iOS/node_modules/os-locale", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", "url": "sindresorhus.com" }, "bugs": { "url": "https://github.com/sindresorhus/execa/issues" }, "dependencies": { "cross-spawn": "^5.0.1", "get-stream": "^3.0.0", "is-stream": "^1.1.0", "npm-run-path": "^2.0.0", "p-finally": "^1.0.0", "signal-exit": "^3.0.0", "strip-eof": "^1.0.0" }, "description": "A better `child_process`", "devDependencies": { "ava": "*", "cat-names": "^1.0.2", "coveralls": "^2.11.9", "delay": "^2.0.0", "is-running": "^2.0.0", "nyc": "^11.0.2", "tempfile": "^2.0.0", "xo": "*" }, "directories": {}, "dist": { "shasum": "944becd34cc41ee32a63a9faf27ad5a65fc59777", "tarball": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz" }, "engines": { "node": ">=4" }, "files": [ "index.js", "lib" ], "gitHead": "b4d1c8613fd068e3c36f11e7bff672d008ac88f9", "homepage": "https://github.com/sindresorhus/execa#readme", "keywords": [ "exec", "child", "process", "execute", "fork", "execfile", "spawn", "file", "shell", "bin", "binary", "binaries", "npm", "path", "local" ], "license": "MIT", "maintainers": [ { "name": "James Talmage", "email": "james@talmage.io", "url": "github.com/jamestalmage" } ], "name": "execa", "nyc": { "reporter": [ "text", "lcov" ], "exclude": [ "**/fixtures/**", "**/test.js", "**/test/**" ] }, "optionalDependencies": {}, "readme": "# execa [![Build Status: Linux](https://travis-ci.org/sindresorhus/execa.svg?branch=master)](https://travis-ci.org/sindresorhus/execa) [![Build status: Windows](https://ci.appveyor.com/api/projects/status/x5ajamxtjtt93cqv/branch/master?svg=true)](https://ci.appveyor.com/project/sindresorhus/execa/branch/master) [![Coverage Status](https://coveralls.io/repos/github/sindresorhus/execa/badge.svg?branch=master)](https://coveralls.io/github/sindresorhus/execa?branch=master)\n\n> A better [`child_process`](https://nodejs.org/api/child_process.html)\n\n\n## Why\n\n- Promise interface.\n- [Strips EOF](https://github.com/sindresorhus/strip-eof) from the output so you don't have to `stdout.trim()`.\n- Supports [shebang](https://en.wikipedia.org/wiki/Shebang_(Unix)) binaries cross-platform.\n- [Improved Windows support.](https://github.com/IndigoUnited/node-cross-spawn#why)\n- Higher max buffer. 10 MB instead of 200 KB.\n- [Executes locally installed binaries by name.](#preferlocal)\n- [Cleans up spawned processes when the parent process dies.](#cleanup)\n\n\n## Install\n\n```\n$ npm install --save execa\n```\n\n\n## Usage\n\n```js\nconst execa = require('execa');\n\nexeca('echo', ['unicorns']).then(result => {\n\tconsole.log(result.stdout);\n\t//=> 'unicorns'\n});\n\n// pipe the child process stdout to the current stdout\nexeca('echo', ['unicorns']).stdout.pipe(process.stdout);\n\nexeca.shell('echo unicorns').then(result => {\n\tconsole.log(result.stdout);\n\t//=> 'unicorns'\n});\n\n// example of catching an error\nexeca.shell('exit 3').catch(error => {\n\tconsole.log(error);\n\t/*\n\t{\n\t\tmessage: 'Command failed: /bin/sh -c exit 3'\n\t\tkilled: false,\n\t\tcode: 3,\n\t\tsignal: null,\n\t\tcmd: '/bin/sh -c exit 3',\n\t\tstdout: '',\n\t\tstderr: '',\n\t\ttimedOut: false\n\t}\n\t*/\n});\n```\n\n\n## API\n\n### execa(file, [arguments], [options])\n\nExecute a file.\n\nThink of this as a mix of `child_process.execFile` and `child_process.spawn`.\n\nReturns a [`child_process` instance](https://nodejs.org/api/child_process.html#child_process_class_childprocess), which is enhanced to also be a `Promise` for a result `Object` with `stdout` and `stderr` properties.\n\n### execa.stdout(file, [arguments], [options])\n\nSame as `execa()`, but returns only `stdout`.\n\n### execa.stderr(file, [arguments], [options])\n\nSame as `execa()`, but returns only `stderr`.\n\n### execa.shell(command, [options])\n\nExecute a command through the system shell. Prefer `execa()` whenever possible, as it's both faster and safer.\n\nReturns a [`child_process` instance](https://nodejs.org/api/child_process.html#child_process_class_childprocess).\n\nThe `child_process` instance is enhanced to also be promise for a result object with `stdout` and `stderr` properties.\n\n### execa.sync(file, [arguments], [options])\n\nExecute a file synchronously.\n\nReturns the same result object as [`child_process.spawnSync`](https://nodejs.org/api/child_process.html#child_process_child_process_spawnsync_command_args_options).\n\nThis method throws an `Error` if the command fails.\n\n### execa.shellSync(file, [options])\n\nExecute a command synchronously through the system shell.\n\nReturns the same result object as [`child_process.spawnSync`](https://nodejs.org/api/child_process.html#child_process_child_process_spawnsync_command_args_options).\n\n### options\n\nType: `Object`\n\n#### cwd\n\nType: `string`
\nDefault: `process.cwd()`\n\nCurrent working directory of the child process.\n\n#### env\n\nType: `Object`
\nDefault: `process.env`\n\nEnvironment key-value pairs. Extends automatically from `process.env`. Set `extendEnv` to `false` if you don't want this.\n\n#### extendEnv\n\nType: `boolean`
\nDefault: `true`\n\nSet to `false` if you don't want to extend the environment variables when providing the `env` property.\n\n#### argv0\n\nType: `string`\n\nExplicitly set the value of `argv[0]` sent to the child process. This will be set to `command` or `file` if not specified.\n\n#### stdio\n\nType: `Array` `string`
\nDefault: `pipe`\n\nChild's [stdio](https://nodejs.org/api/child_process.html#child_process_options_stdio) configuration.\n\n#### detached\n\nType: `boolean`\n\nPrepare child to run independently of its parent process. Specific behavior [depends on the platform](https://nodejs.org/api/child_process.html#child_process_options_detached).\n\n#### uid\n\nType: `number`\n\nSets the user identity of the process.\n\n#### gid\n\nType: `number`\n\nSets the group identity of the process.\n\n#### shell\n\nType: `boolean` `string`
\nDefault: `false`\n\nIf `true`, runs `command` inside of a shell. Uses `/bin/sh` on UNIX and `cmd.exe` on Windows. A different shell can be specified as a string. The shell should understand the `-c` switch on UNIX or `/d /s /c` on Windows.\n\n#### stripEof\n\nType: `boolean`
\nDefault: `true`\n\n[Strip EOF](https://github.com/sindresorhus/strip-eof) (last newline) from the output.\n\n#### preferLocal\n\nType: `boolean`
\nDefault: `true`\n\nPrefer locally installed binaries when looking for a binary to execute.
\nIf you `$ npm install foo`, you can then `execa('foo')`.\n\n#### localDir\n\nType: `string`
\nDefault: `process.cwd()`\n\nPreferred path to find locally installed binaries in (use with `preferLocal`).\n\n#### input\n\nType: `string` `Buffer` `stream.Readable`\n\nWrite some input to the `stdin` of your binary.
\nStreams are not allowed when using the synchronous methods.\n\n#### reject\n\nType: `boolean`
\nDefault: `true`\n\nSetting this to `false` resolves the promise with the error instead of rejecting it.\n\n#### cleanup\n\nType: `boolean`
\nDefault: `true`\n\nKeep track of the spawned process and `kill` it when the parent process exits.\n\n#### encoding\n\nType: `string`
\nDefault: `utf8`\n\nSpecify the character encoding used to decode the `stdout` and `stderr` output.\n\n#### timeout\n\nType: `number`
\nDefault: `0`\n\nIf timeout is greater than `0`, the parent will send the signal identified by the `killSignal` property (the default is `SIGTERM`) if the child runs longer than timeout milliseconds.\n\n#### maxBuffer\n\nType: `number`
\nDefault: `10000000` (10MB)\n\nLargest amount of data in bytes allowed on `stdout` or `stderr`.\n\n#### killSignal\n\nType: `string` `number`
\nDefault: `SIGTERM`\n\nSignal value to be used when the spawned process will be killed.\n\n#### stdin\n\nType: `string` `number` `Stream` `undefined` `null`
\nDefault: `pipe`\n\nSame options as [`stdio`](https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_options_stdio).\n\n#### stdout\n\nType: `string` `number` `Stream` `undefined` `null`
\nDefault: `pipe`\n\nSame options as [`stdio`](https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_options_stdio).\n\n#### stderr\n\nType: `string` `number` `Stream` `undefined` `null`
\nDefault: `pipe`\n\nSame options as [`stdio`](https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_options_stdio).\n\n\n## Tips\n\n### Save and pipe output from a child process\n\nLet's say you want to show the output of a child process in real-time while also saving it to a variable.\n\n```js\nconst execa = require('execa');\nconst getStream = require('get-stream');\n\nconst stream = execa('echo', ['foo']).stdout;\n\nstream.pipe(process.stdout);\n\ngetStream(stream).then(value => {\n\tconsole.log('child output:', value);\n});\n```\n\n\n## License\n\nMIT © [Sindre Sorhus](https://sindresorhus.com)\n", "readmeFilename": "readme.md", "repository": { "type": "git", "url": "git+https://github.com/sindresorhus/execa.git" }, "scripts": { "test": "xo && nyc ava" }, "version": "0.7.0" }