UNPKG

pnpm

Version:

Fast, disk space efficient package manager

146 lines (145 loc) 12.8 kB
{ "_args": [ [ { "raw": "execa@1.0.0", "scope": null, "escapedName": "execa", "name": "execa", "rawSpec": "1.0.0", "spec": "1.0.0", "type": "version" }, "/home/zoltan/src/pnpm/pnpm/packages/pnpm" ] ], "_from": "execa@1.0.0", "_hasShrinkwrap": false, "_id": "execa@1.0.0", "_location": "/execa", "_nodeVersion": "8.11.3", "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/execa_1.0.0_1535305424092_0.2806930373405232" }, "_npmUser": { "name": "sindresorhus", "email": "sindresorhus@gmail.com" }, "_npmVersion": "6.4.0", "_phantomChildren": {}, "_requested": { "raw": "execa@1.0.0", "scope": null, "escapedName": "execa", "name": "execa", "rawSpec": "1.0.0", "spec": "1.0.0", "type": "version" }, "_requiredBy": [ "/", "/@pnpm/git-fetcher", "/graceful-git", "/os-locale", "/supi" ], "_resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz", "_shasum": "c6236a5bb4df6d6f15e88e7f017798216749ddd8", "_shrinkwrap": null, "_spec": "execa@1.0.0", "_where": "/home/zoltan/src/pnpm/pnpm/packages/pnpm", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", "url": "sindresorhus.com" }, "bugs": { "url": "https://github.com/sindresorhus/execa/issues" }, "dependencies": { "cross-spawn": "^6.0.0", "get-stream": "^4.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": "^3.0.1", "delay": "^3.0.0", "is-running": "^2.0.0", "nyc": "^13.0.1", "tempfile": "^2.0.0", "xo": "*" }, "directories": {}, "dist": { "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==", "shasum": "c6236a5bb4df6d6f15e88e7f017798216749ddd8", "tarball": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz", "fileCount": 6, "unpackedSize": 19885, "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbgubQCRA9TVsSAnZWagAAIsEQAIs35D02H15nByFfN/Ht\nMtyJPq3y8M4HKouIKuHWiO1auu6fmt/uhFpzNJJfnwhJoZBUPs/OZBi2w8jr\n4zglnRGX5w323oLVFEZHWIUny6YSNnDsxjKnDkrKw6j/3Z/dAo6o/QPO4/4n\nVgyLhQQuhvNnB6z6iH9tgpxTwyVcVetWqJOBT3T4idkbgAmZAsE/m/1RoUUN\nuq/72dV8H4jomYCvKvoeVsj+RpeTuCGoQFwoN/xjkuHh0EqWp3D13wJyc8Pc\n2tS2+mf/0FZaMFEELoMV6W6dBI320xSBgD1mc0zJ8fy//oDmjctiIKVKEQRJ\nCPiQIuKKZ2HlC7cHUnGK9KNHk3DLiHVi6gJxepzdoSUArrF4J23v7JyQxzpm\nR12+DwMIL+TF3e/+XljqfpmNlbShh1Bvmx56ih2to9JafN0BobOHRMrQcqSz\nmcnFQCpQIGx4Cck0/TaumL3mZDsZ9DS6jPKrYEeJ5MkgU0Y2/p1MIB6dbhae\nvGJRmYlDuXm7DNTDdpuUo+vTYtRWvXA+O7K1V7lwavUbJ/eA+dlwxfcAKJFD\n6QKrVKtnCJmQqfP9rwJSXCYtWQ90+gGfoNDijcpoQj9H3pqcCnM0bAKaJbOm\n0s+k2TpbCFu9sqlGAYLZl3uwV3FqdyjrAWW/zjvn/S7O6cxjiYFk/Qhn+OS4\ns9FU\r\n=B9g6\r\n-----END PGP SIGNATURE-----\r\n" }, "engines": { "node": ">=6" }, "files": [ "index.js", "lib" ], "gitHead": "c8dccf7de66c65f4b9b821ec00871fea386fb35f", "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": "sindresorhus", "email": "sindresorhus@gmail.com" } ], "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 execa\n```\n\n<a href=\"https://www.patreon.com/sindresorhus\">\n\t<img src=\"https://c5.patreon.com/external/logo/become_a_patron_button@2x.png\" width=\"160\">\n</a>\n\n\n## Usage\n\n```js\nconst execa = require('execa');\n\n(async () => {\n\tconst {stdout} = await execa('echo', ['unicorns']);\n\tconsole.log(stdout);\n\t//=> 'unicorns'\n})();\n```\n\nAdditional examples:\n\n```js\nconst execa = require('execa');\n\n(async () => {\n\t// Pipe the child process stdout to the current stdout\n\texeca('echo', ['unicorns']).stdout.pipe(process.stdout);\n\n\n\t// Run a shell command\n\tconst {stdout} = await execa.shell('echo unicorns');\n\t//=> 'unicorns'\n\n\n\t// Catching an error\n\ttry {\n\t\tawait execa.shell('exit 3');\n\t} catch (error) {\n\t\tconsole.log(error);\n\t\t/*\n\t\t{\n\t\t\tmessage: 'Command failed: /bin/sh -c exit 3'\n\t\t\tkilled: false,\n\t\t\tcode: 3,\n\t\t\tsignal: null,\n\t\t\tcmd: '/bin/sh -c exit 3',\n\t\t\tstdout: '',\n\t\t\tstderr: '',\n\t\t\ttimedOut: false\n\t\t}\n\t\t*/\n\t}\n})();\n\n// Catching an error with a sync method\ntry {\n\texeca.shellSync('exit 3');\n} catch (error) {\n\tconsole.log(error);\n\t/*\n\t{\n\t\tmessage: 'Command failed: /bin/sh -c exit 3'\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`<br>\nDefault: `process.cwd()`\n\nCurrent working directory of the child process.\n\n#### env\n\nType: `Object`<br>\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`<br>\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: `string[]` `string`<br>\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`<br>\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`<br>\nDefault: `true`\n\n[Strip EOF](https://github.com/sindresorhus/strip-eof) (last newline) from the output.\n\n#### preferLocal\n\nType: `boolean`<br>\nDefault: `true`\n\nPrefer locally installed binaries when looking for a binary to execute.<br>\nIf you `$ npm install foo`, you can then `execa('foo')`.\n\n#### localDir\n\nType: `string`<br>\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.<br>\nStreams are not allowed when using the synchronous methods.\n\n#### reject\n\nType: `boolean`<br>\nDefault: `true`\n\nSetting this to `false` resolves the promise with the error instead of rejecting it.\n\n#### cleanup\n\nType: `boolean`<br>\nDefault: `true`\n\nKeep track of the spawned process and `kill` it when the parent process exits.\n\n#### encoding\n\nType: `string`<br>\nDefault: `utf8`\n\nSpecify the character encoding used to decode the `stdout` and `stderr` output.\n\n#### timeout\n\nType: `number`<br>\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#### buffer\n\nType: `boolean`<br>\nDefault: `true`\n\nBuffer the output from the spawned process. When buffering is disabled you must consume the output of the `stdout` and `stderr` streams because the promise will not be resolved/rejected until they have completed.\n\n#### maxBuffer\n\nType: `number`<br>\nDefault: `10000000` (10MB)\n\nLargest amount of data in bytes allowed on `stdout` or `stderr`.\n\n#### killSignal\n\nType: `string` `number`<br>\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`<br>\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`<br>\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`<br>\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#### windowsVerbatimArguments\n\nType: `boolean`<br>\nDefault: `false`\n\nIf `true`, no quoting or escaping of arguments is done on Windows. Ignored on other platforms. This is set to `true` automatically when the `shell` option is `true`.\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": "1.0.0" }