{ "_args": [ [ { "raw": "exec-sh@^0.2.0", "scope": null, "escapedName": "exec-sh", "name": "exec-sh", "rawSpec": "^0.2.0", "spec": ">=0.2.0 <0.3.0", "type": "range" }, "/home/jdaugherty/work/GT2/GT2-Android/node_modules/sane" ] ], "_from": "exec-sh@>=0.2.0 <0.3.0", "_id": "exec-sh@0.2.1", "_inCache": true, "_location": "/exec-sh", "_nodeVersion": "8.4.0", "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/exec-sh-0.2.1.tgz_1504815304403_0.6077115300577134" }, "_npmUser": { "name": "tsertkov", "email": "tsertkov@gmail.com" }, "_npmVersion": "5.4.1", "_phantomChildren": {}, "_requested": { "raw": "exec-sh@^0.2.0", "scope": null, "escapedName": "exec-sh", "name": "exec-sh", "rawSpec": "^0.2.0", "spec": ">=0.2.0 <0.3.0", "type": "range" }, "_requiredBy": [ "/sane", "/watch" ], "_resolved": "https://registry.npmjs.org/exec-sh/-/exec-sh-0.2.1.tgz", "_shasum": "163b98a6e89e6b65b47c2a28d215bc1f63989c38", "_shrinkwrap": null, "_spec": "exec-sh@^0.2.0", "_where": "/home/jdaugherty/work/GT2/GT2-Android/node_modules/sane", "author": { "name": "Aleksandr Tsertkov", "email": "tsertkov@gmail.com" }, "bugs": { "url": "https://github.com/tsertkov/exec-sh/issues" }, "dependencies": { "merge": "^1.1.3" }, "description": "Execute shell command forwarding all stdio.", "devDependencies": { "coveralls": "^2.11.2", "istanbul": "^0.3.2", "jsdoc": "^3.3.0-alpha8", "jshint": "^2.5.1", "mocha": "^1.20.1", "sinon": "^1.10.2" }, "directories": {}, "dist": { "integrity": "sha512-aLt95pexaugVtQerpmE51+4QfWrNc304uez7jvj6fWnN8GeEHpttB8F36n8N7uVhUMbH/1enbxQ9HImZ4w/9qg==", "shasum": "163b98a6e89e6b65b47c2a28d215bc1f63989c38", "tarball": "https://registry.npmjs.org/exec-sh/-/exec-sh-0.2.1.tgz" }, "gitHead": "92959b9d8d2922a899a4452607cc1c7a2451f740", "homepage": "https://github.com/tsertkov/exec-sh#readme", "keywords": [ "exec", "spawn", "terminal", "console", "shell", "command", "child_process" ], "license": { "type": "MIT", "url": "https://github.com/tsertkov/exec-sh/blob/master/LICENSE" }, "main": "lib/exec-sh.js", "maintainers": [ { "name": "tsertkov", "email": "tsertkov@gmail.com" } ], "name": "exec-sh", "optionalDependencies": {}, "readme": "# exec-sh\n\n[![NPM](https://nodei.co/npm/exec-sh.png)](https://nodei.co/npm/exec-sh/)\n\n[![Build Status](https://travis-ci.org/tsertkov/exec-sh.svg?branch=master)](https://travis-ci.org/tsertkov/exec-sh)\n[![Coverage Status](https://img.shields.io/coveralls/tsertkov/exec-sh.svg)](https://coveralls.io/r/tsertkov/exec-sh?branch=master)\n[![David Status](https://david-dm.org/tsertkov/exec-sh.png)](https://david-dm.org/tsertkov/exec-sh)\n\n> Execute shell command forwarding all stdio streams.\n\n## Features\n\nexec-sh is a wrapper for [`child_process.spawn`](http://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options) with some improvements:\n\n- Cross platform command execution:\n - Windows: `cmd /C COMMAND`\n - others: `sh -c COMMAND`\n- Fowrards all stdio streams to current terminal (by default):\n - `execSh(\"bash\")`\n - `execsh(\"echo -n Say: && read i && echo Said:$i\")`\n- stdout and stderr are passed to callback when available\n - `execSh(\"pwd\", console.log)`\n\n## Showcase\n```javascript\n// JavaScript\n\nexecSh(\"echo hello exec-sh && bash\", { cwd: \"/home\" }, function(err){\n if (err) {\n console.log(\"Exit code: \", err.code);\n }\n});\n```\n\n```sh\n# Terminal output: interactive bash session\n\nhello exec-sh\nbash-3.2$ pwd\n/home\nbash-3.2$ exit 99\nexit\nExit code: 99\n```\n\n## Usage\n\n```javascript\nvar execSh = require(\"../\");\n\n// run interactive bash shell\nexecSh(\"echo lorem && bash\", { cwd: \"/home\" }, function(err){\n if (err) {\n console.log(\"Exit code: \", err.code);\n return;\n }\n\n // collect streams output\n var child = execSh([\"bash -c id\", \"echo lorem >&2\"], true,\n function(err, stdout, stderr){\n console.log(\"error: \", err);\n console.log(\"stdout: \", stdout);\n console.log(\"stderr: \", stderr);\n });\n});\n```\n\n## Public API\n\n### `execSh(command, [options], [callback])`\n\nExecute shell command forwarding all stdio.\n\n**Parameters:**\n\n- `command {String|Array}` - The command to run, or array of commands\n- `[options] {Object|TRUE}` - Options object passed directly to [`child_process.spawn`](http://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options), when `TRUE` then `{ stdio: null }` used\n- `[callback] {Function}` - `callback(err, stdout, stderr)`\n - `err {Error|NULL}` - Error object. Has `code` property containing last command exit code when available\n - `stdout {String|NULL}` - aggregated stdout or `NULL` if not available\n - `stderr {String|NULL}` - aggregated stderr or `NULL` if not available\n\n**Return Values:**\n\nReturns [ChildProcess](http://nodejs.org/api/child_process.html#child_process_class_childprocess) object.\n\n## Private API\nComplete API Documentation including private and public methods is generated from source code by JSDoc tool and is [available here](https://s3.eu-central-1.amazonaws.com/tsertkov-artifacts/exec-sh/master/jsdoc/index.html).\n\n## Code Coverage\nCode coverage report for all files is [available here](https://s3.eu-central-1.amazonaws.com/tsertkov-artifacts/exec-sh/master/coverage/lcov-report/index.html).\n\n## Scripts\n\n- `npm test` - run tests\n- `npm run jsdoc` - build jsdoc\n- `npm run dev` - run tests continuously\n\n## License\n\nThe MIT License (MIT)\n", "readmeFilename": "README.md", "repository": { "type": "git", "url": "git+ssh://git@github.com/tsertkov/exec-sh.git" }, "scripts": { "cover-test": "istanbul cover --dir artifacts/coverage _mocha -- --reporter spec", "dev": "mocha --reporter spec --watch", "jsdoc": "jsdoc --private --destination artifacts/jsdoc lib/", "jshint": "jshint lib/ example/ test/ package.json", "test": "npm run cover-test && npm run jshint" }, "version": "0.2.1" }