Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add serialization option #392

Merged
merged 7 commits into from Nov 24, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 11 additions & 0 deletions index.d.ts
Expand Up @@ -135,6 +135,17 @@ declare namespace execa {
*/
readonly stdio?: 'pipe' | 'ignore' | 'inherit' | readonly StdioOption[];

/**
When using the `stdio: 'ipc'` option or `execa.node()`, how messages passed to [`childProcess.send()`](https://nodejs.org/api/child_process.html#child_process_subprocess_send_message_sendhandle_options_callback) are serialized:
ehmicky marked this conversation as resolved.
Show resolved Hide resolved
- `json`: uses `JSON.serialize()`
ehmicky marked this conversation as resolved.
Show resolved Hide resolved
- `advanced`: uses [`v8.serialize()`](https://nodejs.org/api/v8.html#v8_v8_serialize_value)
ehmicky marked this conversation as resolved.
Show resolved Hide resolved

See more information [here](https://nodejs.org/api/child_process.html#child_process_advanced_serialization).
ehmicky marked this conversation as resolved.
Show resolved Hide resolved

@default 'json'
*/
readonly serialization?: 'json' | 'advanced';

/**
Prepare 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).

Expand Down
1 change: 1 addition & 0 deletions index.test-d.ts
Expand Up @@ -115,6 +115,7 @@ execa('unicorns', {stdio: 'inherit'});
execa('unicorns', {
stdio: ['pipe', 'ipc', 'ignore', 'inherit', process.stdin, 1, undefined]
});
execa('unicorns', {serialization: 'advanced'});
execa('unicorns', {detached: true});
execa('unicorns', {uid: 0});
execa('unicorns', {gid: 0});
Expand Down
11 changes: 11 additions & 0 deletions readme.md
Expand Up @@ -451,6 +451,17 @@ Default: `pipe`

Child's [stdio](https://nodejs.org/api/child_process.html#child_process_options_stdio) configuration.

#### serialization

Type: `string`<br>
Default: `json`
ehmicky marked this conversation as resolved.
Show resolved Hide resolved

When using the [`stdio: 'ipc'`](#stdio) option or [`execa.node()`](#execanodescriptpath-arguments-options), how messages passed to [`childProcess.send()`](https://nodejs.org/api/child_process.html#child_process_subprocess_send_message_sendhandle_options_callback) are serialized:
- `json`: uses `JSON.serialize()`
ehmicky marked this conversation as resolved.
Show resolved Hide resolved
- `advanced`: uses [`v8.serialize()`](https://nodejs.org/api/v8.html#v8_v8_serialize_value)

See more information [here](https://nodejs.org/api/child_process.html#child_process_advanced_serialization).

#### detached

Type: `boolean`
Expand Down