Last change
on this file since fa375fe was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
1.5 KB
|
Rev | Line | |
---|
[6a3a178] | 1 | # set-blocking
|
---|
| 2 |
|
---|
| 3 | [![Build Status](https://travis-ci.org/yargs/set-blocking.svg)](https://travis-ci.org/yargs/set-blocking)
|
---|
| 4 | [![NPM version](https://img.shields.io/npm/v/set-blocking.svg)](https://www.npmjs.com/package/set-blocking)
|
---|
| 5 | [![Coverage Status](https://coveralls.io/repos/yargs/set-blocking/badge.svg?branch=)](https://coveralls.io/r/yargs/set-blocking?branch=master)
|
---|
| 6 | [![Standard Version](https://img.shields.io/badge/release-standard%20version-brightgreen.svg)](https://github.com/conventional-changelog/standard-version)
|
---|
| 7 |
|
---|
| 8 | set blocking `stdio` and `stderr` ensuring that terminal output does not truncate.
|
---|
| 9 |
|
---|
| 10 | ```js
|
---|
| 11 | const setBlocking = require('set-blocking')
|
---|
| 12 | setBlocking(true)
|
---|
| 13 | console.log(someLargeStringToOutput)
|
---|
| 14 | ```
|
---|
| 15 |
|
---|
| 16 | ## Historical Context/Word of Warning
|
---|
| 17 |
|
---|
| 18 | This was created as a shim to address the bug discussed in [node #6456](https://github.com/nodejs/node/issues/6456). This bug crops up on
|
---|
| 19 | newer versions of Node.js (`0.12+`), truncating terminal output.
|
---|
| 20 |
|
---|
| 21 | You should be mindful of the side-effects caused by using `set-blocking`:
|
---|
| 22 |
|
---|
| 23 | * if your module sets blocking to `true`, it will effect other modules
|
---|
| 24 | consuming your library. In [yargs](https://github.com/yargs/yargs/blob/master/yargs.js#L653) we only call
|
---|
| 25 | `setBlocking(true)` once we already know we are about to call `process.exit(code)`.
|
---|
| 26 | * this patch will not apply to subprocesses spawned with `isTTY = true`, this is
|
---|
| 27 | the [default `spawn()` behavior](https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options).
|
---|
| 28 |
|
---|
| 29 | ## License
|
---|
| 30 |
|
---|
| 31 | ISC
|
---|
Note:
See
TracBrowser
for help on using the repository browser.