New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

spawncommand

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

spawncommand - npm Package Compare versions

Comparing version 2.1.2 to 2.2.0

externs.js

64

build/index.js

@@ -5,3 +5,4 @@ const { spawn, fork: forkCp } = require('child_process');

/**
* @returns {PromiseResult}
* @param {!child_process.ChildProcess} proc
* @returns {!Promise<_spawncommand.PromiseResult>}
*/

@@ -29,12 +30,13 @@ const getPromise = async (proc) => {

* @param {string} command The command to run.
* @param {string[]} [args] List of string arguments.
* @param {SpawnOptions} [options] Options used to spawn.
* @param {!Array<string>} [args] List of string arguments.
* @param {!child_process.SpawnOptions} [options] Options used to spawn.
*/
function spawnCommand(command, args = [], options = {}) {
function spawnCommand(command, args, options) {
if (!command) throw new Error('Please specify a command to spawn.')
const proc = spawn(command, args, options)
const proc = /** @type {!_spawncommand.ChildProcessWithPromise} */ (spawn(command, args, options))
const promise = getPromise(proc)
proc.promise = promise
proc.spawnCommand = proc.spawnargs.join(' ')
/** @suppress {checkTypes} */
proc.spawnCommand = proc['spawnargs'].join(' ')
return proc

@@ -46,22 +48,24 @@ }

* @param {string} mod The module to run in the child.
* @param {string[]} [args] List of string arguments.
* @param {ForkOptions} [options] Options to fork the process with.
* @param {!Array<string>} [args] List of string arguments.
* @param {!child_process.ForkOptions} [options] Options to fork the process with.
*/
function fork(mod, args = [], options) {
function fork(mod, args, options) {
if (!mod) throw new Error('Please specify a module to fork')
const proc = forkCp(mod, args, options)
const proc = /** @type {!_spawncommand.ChildProcessWithPromise} */ (forkCp(mod, args, options))
const promise = getPromise(proc)
proc.promise = promise
proc.spawnCommand = proc.spawnargs.join(' ')
/** @suppress {checkTypes} */
proc.spawnCommand = proc['spawnargs'].join(' ')
return proc
}
/* documentary types/index.xml */
/* typal types/index.xml */
/**
* @typedef {import('child_process').SpawnOptions} SpawnOptions
* @typedef {import('child_process').ForkOptions} ForkOptions
* @typedef {import('child_process').ChildProcess} ChildProcess
*
* @typedef {Object} PromiseResult
* @suppress {nonStandardJsDocs}
* @typedef {_spawncommand.PromiseResult} PromiseResult
*/
/**
* @suppress {nonStandardJsDocs}
* @typedef {Object} _spawncommand.PromiseResult
* @prop {string} stdout The accumulated result of the `stdout` stream.

@@ -71,8 +75,30 @@ * @prop {string} stderr The accumulated result of the `stderr` stream.

*/
/**
* @suppress {nonStandardJsDocs}
* @typedef {import('child_process').SpawnOptions} child_process.SpawnOptions
*/
/**
* @suppress {nonStandardJsDocs}
* @typedef {import('child_process').ForkOptions} child_process.ForkOptions
*/
/**
* @suppress {nonStandardJsDocs}
* @typedef {import('child_process').ChildProcess} child_process.ChildProcess
*/
/* documentary types/cp.xml */
/**
* @typedef {ChildProcess} ChildProcessWithPromise A child process with an extra `promise` property.
* @prop {Promise.<PromiseResult>} promise A promise resolved when the process exits.
* @suppress {nonStandardJsDocs}
* @typedef {_spawncommand.ChildProcessWithPromise} ChildProcessWithPromise A child process with an extra `promise` property.
*/
/**
* @suppress {nonStandardJsDocs}
* @typedef {child_process.ChildProcess & _spawncommand.$ChildProcessWithPromise} _spawncommand.ChildProcessWithPromise A child process with an extra `promise` property.
*/
/**
* @suppress {nonStandardJsDocs}
* @typedef {Object} _spawncommand.$ChildProcessWithPromise A child process with an extra `promise` property.
* @prop {!Promise<!_spawncommand.PromiseResult>} promise A promise resolved when the process exits.
* @prop {string} spawnCommand The spawn arguments joined by whitespace.
*/

@@ -79,0 +105,0 @@

@@ -0,4 +1,10 @@

## 25 April 2019
### [2.2.0](https://github.com/artdecocode/spawncommand/compare/v2.1.2...v2.2.0)
- [externs] Publish externs for _GCC_; extend type.
## 4 April 2019
### [2.1.2](git+https://github.com/artdecocode/spawncommand/compare/v2.1.1...v2.1.2)
### [2.1.2](https://github.com/artdecocode/spawncommand/compare/v2.1.1...v2.1.2)

@@ -5,0 +11,0 @@ - [deps] Unfix dependencies, upgrade `catchment`.

{
"name": "spawncommand",
"version": "2.1.2",
"version": "2.2.0",
"description": "Spawn or fork a child process with a promise property resolved on exit with stdout, stderr and code.",
"main": "build",
"module": "src",
"files": [
"build",
"src"
],
"main": "build/index.js",
"module": "src/index.js",
"scripts": {

@@ -16,4 +12,3 @@ "t": "zoroaster -a",

"build": "yarn-s d b doc",
"d": "doc src/index.js -g",
"doc": "NODE_DEBUG=doc doc documentary -o README.md",
"doc": "NODE_DEBUG=doc doc -o README.md",
"test-build": "ALAMODE_ENV=test-build yarn test",

@@ -23,7 +18,16 @@ "example/spawncommand.js": "node example example/spawncommand",

"example/pipe.js": "node example example/pipe",
"e": "alanode"
"e": "alanode",
"d": "yarn-s d1 externs",
"d1": "typal src -c",
"externs": "typal externs.js -e"
},
"files": [
"build",
"src",
"externs.js"
],
"externs": "externs.js",
"repository": {
"type": "git",
"url": "git+https://github.com/artdecocode/spawncommand.git"
"url": "git://github.com/artdecocode/spawncommand.git"
},

@@ -49,10 +53,10 @@ "keywords": [

"devDependencies": {
"alamode": "^1.9.2",
"documentary": "^1.23.4",
"alamode": "^2.0.0",
"documentary": "^1.26.0",
"yarn-s": "1.1.0",
"zoroaster": "^3.11.4"
"zoroaster": "^3.13.0"
},
"dependencies": {
"catchment": "^3.2.3"
"catchment": "^3.3.0"
}
}

@@ -8,3 +8,3 @@ # spawnCommand

```
yarn add -E spawncommand
yarn add spawncommand
```

@@ -19,4 +19,4 @@

* [Types](#types)
* [`ChildProcessWithPromise`](#type-childprocesswithpromise)
* [`PromiseResult`](#type-promiseresult)
* [`_spawncommand.ChildProcessWithPromise`](#type-_spawncommandchildprocesswithpromise)
* [`_spawncommand.PromiseResult`](#type-_spawncommandpromiseresult)
* [`spawn(module: string, args: string[], options?: SpawnOptions): ChildProcessWithPromise`](#spawnmodule-stringargs-stringoptions-spawnoptions-childprocesswithpromise)

@@ -42,17 +42,18 @@ * [`fork(module: string, args: string[], options?: ForkOptions): ChildProcessWithPromise`](#forkmodule-stringargs-stringoptions-forkoptions-childprocesswithpromise)

[`import('child_process').ChildProcess`](https://nodejs.org/api/child_process.html#child_process_class_childprocess) __<a name="type-childprocess">`ChildProcess`</a>__
[`import('child_process').ChildProcess`](https://nodejs.org/api/child_process.html#child_process_class_childprocess) __<a name="type-child_processchildprocess">`child_process.ChildProcess`</a>__
`ChildProcess` __<a name="type-childprocesswithpromise">`ChildProcessWithPromise`</a>__: A child process with an extra `promise` property.
__<a name="type-_spawncommandchildprocesswithpromise">`_spawncommand.ChildProcessWithPromise`</a>__: A child process with an extra `promise` property.
| Name | Type | Description |
| ------------ | ------------------------------------------------------ | ------------------------------------------ |
| __promise*__ | _Promise.&lt;[PromiseResult](#type-promiseresult)&gt;_ | A promise resolved when the process exits. |
| Name | Type | Description |
| ----------------- | ----------------------------------------------------- | ------------------------------------------ |
| __promise*__ | <em>!Promise&lt;!_spawncommand.PromiseResult&gt;</em> | A promise resolved when the process exits. |
| __spawnCommand*__ | <em>string</em> | The spawn arguments joined by whitespace. |
__<a name="type-promiseresult">`PromiseResult`</a>__
__<a name="type-_spawncommandpromiseresult">`_spawncommand.PromiseResult`</a>__
| Name | Type | Description |
| ----------- | -------- | ---------------------------------------------- |
| __stdout*__ | _string_ | The accumulated result of the `stdout` stream. |
| __stderr*__ | _string_ | The accumulated result of the `stderr` stream. |
| __code*__ | _number_ | The code with which the process exited. |
| Name | Type | Description |
| ----------- | --------------- | ---------------------------------------------- |
| __stdout*__ | <em>string</em> | The accumulated result of the `stdout` stream. |
| __stderr*__ | <em>string</em> | The accumulated result of the `stderr` stream. |
| __code*__ | <em>number</em> | The code with which the process exited. |

@@ -65,3 +66,3 @@ <p align="center"><a href="#table-of-contents"><img src=".documentary/section-breaks/3.svg?sanitize=true" width="15"></a></p>

`import('child_process').SpawnOptions` __<a name="type-spawnoptions">`SpawnOptions`</a>__
`import('child_process').SpawnOptions` __<a name="type-child_processspawnoptions">`child_process.SpawnOptions`</a>__

@@ -109,3 +110,3 @@ ```js

`import('child_process').ForkOptions` __<a name="type-forkoptions">`ForkOptions`</a>__
`import('child_process').ForkOptions` __<a name="type-child_processforkoptions">`child_process.ForkOptions`</a>__

@@ -138,7 +139,22 @@ ```js

(c) [Art Deco][1] 2018
<table>
<tr>
<th>
<a href="https://artd.eco">
<img src="https://raw.githubusercontent.com/wrote/wrote/master/images/artdeco.png" alt="Art Deco" />
</a>
</th>
<th>© <a href="https://artd.eco">Art Deco</a> 2019</th>
<th>
<a href="https://www.technation.sucks" title="Tech Nation Visa">
<img src="https://raw.githubusercontent.com/artdecoweb/www.technation.sucks/master/anim.gif"
alt="Tech Nation Visa" />
</a>
</th>
<th><a href="https://www.technation.sucks">Tech Nation Visa Sucks</a></th>
</tr>
</table>
[1]: https://artdeco.bz
[2]: https://github.com/nodejs/node/pull/10866
<p align="center"><a href="#table-of-contents"><img src=".documentary/section-breaks/-1.svg?sanitize=true"></a></p>

@@ -5,3 +5,4 @@ import { spawn, fork as forkCp } from 'child_process'

/**
* @returns {PromiseResult}
* @param {!child_process.ChildProcess} proc
* @returns {!Promise<_spawncommand.PromiseResult>}
*/

@@ -29,12 +30,13 @@ const getPromise = async (proc) => {

* @param {string} command The command to run.
* @param {string[]} [args] List of string arguments.
* @param {SpawnOptions} [options] Options used to spawn.
* @param {!Array<string>} [args] List of string arguments.
* @param {!child_process.SpawnOptions} [options] Options used to spawn.
*/
export default function spawnCommand(command, args = [], options = {}) {
export default function spawnCommand(command, args, options) {
if (!command) throw new Error('Please specify a command to spawn.')
const proc = spawn(command, args, options)
const proc = /** @type {!_spawncommand.ChildProcessWithPromise} */ (spawn(command, args, options))
const promise = getPromise(proc)
proc.promise = promise
proc.spawnCommand = proc.spawnargs.join(' ')
/** @suppress {checkTypes} */
proc.spawnCommand = proc['spawnargs'].join(' ')
return proc

@@ -46,22 +48,24 @@ }

* @param {string} mod The module to run in the child.
* @param {string[]} [args] List of string arguments.
* @param {ForkOptions} [options] Options to fork the process with.
* @param {!Array<string>} [args] List of string arguments.
* @param {!child_process.ForkOptions} [options] Options to fork the process with.
*/
export function fork(mod, args = [], options) {
export function fork(mod, args, options) {
if (!mod) throw new Error('Please specify a module to fork')
const proc = forkCp(mod, args, options)
const proc = /** @type {!_spawncommand.ChildProcessWithPromise} */ (forkCp(mod, args, options))
const promise = getPromise(proc)
proc.promise = promise
proc.spawnCommand = proc.spawnargs.join(' ')
/** @suppress {checkTypes} */
proc.spawnCommand = proc['spawnargs'].join(' ')
return proc
}
/* documentary types/index.xml */
/* typal types/index.xml */
/**
* @typedef {import('child_process').SpawnOptions} SpawnOptions
* @typedef {import('child_process').ForkOptions} ForkOptions
* @typedef {import('child_process').ChildProcess} ChildProcess
*
* @typedef {Object} PromiseResult
* @suppress {nonStandardJsDocs}
* @typedef {_spawncommand.PromiseResult} PromiseResult
*/
/**
* @suppress {nonStandardJsDocs}
* @typedef {Object} _spawncommand.PromiseResult
* @prop {string} stdout The accumulated result of the `stdout` stream.

@@ -71,7 +75,29 @@ * @prop {string} stderr The accumulated result of the `stderr` stream.

*/
/**
* @suppress {nonStandardJsDocs}
* @typedef {import('child_process').SpawnOptions} child_process.SpawnOptions
*/
/**
* @suppress {nonStandardJsDocs}
* @typedef {import('child_process').ForkOptions} child_process.ForkOptions
*/
/**
* @suppress {nonStandardJsDocs}
* @typedef {import('child_process').ChildProcess} child_process.ChildProcess
*/
/* documentary types/cp.xml */
/**
* @typedef {ChildProcess} ChildProcessWithPromise A child process with an extra `promise` property.
* @prop {Promise.<PromiseResult>} promise A promise resolved when the process exits.
* @suppress {nonStandardJsDocs}
* @typedef {_spawncommand.ChildProcessWithPromise} ChildProcessWithPromise A child process with an extra `promise` property.
*/
/**
* @suppress {nonStandardJsDocs}
* @typedef {child_process.ChildProcess & _spawncommand.$ChildProcessWithPromise} _spawncommand.ChildProcessWithPromise A child process with an extra `promise` property.
*/
/**
* @suppress {nonStandardJsDocs}
* @typedef {Object} _spawncommand.$ChildProcessWithPromise A child process with an extra `promise` property.
* @prop {!Promise<!_spawncommand.PromiseResult>} promise A promise resolved when the process exits.
* @prop {string} spawnCommand The spawn arguments joined by whitespace.
*/
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