question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

2.1.0 release Breaking/Broken

See original GitHub issue

Platform: Windows Server 2012 R2 Console: Cmder Node Version: v8.1.4

Example code that worked before 2.1.0 release:

const chalk = require('chalk');
const clk = new chalk.constructor({ enabled: true });

console.log(`${clk.bgBlue("Text with blue background")}${clk.bgMagenta("Text with magenta background")} ect`);

2.0.1: image

2.1.0: image

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:13 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
kyranetcommented, Aug 17, 2017

Evaluating process.stdout.isTTY returned undefined in PM2 and the value for process.stdout._type is pipe, however, in a normal Node.js process, the first returned true and _type is tty:

The returned value of console.log(process.stdout); with PM2:

Socket {
  connecting: false,
  _hadError: false,
  _handle: [Object],
  _parent: null,
  _host: null,
  _readableState: [Object],
  readable: false,
  domain: null,
  _events: [Object],
  _eventsCount: 3,
  _maxListeners: undefined,
  _writableState: [Object],
  writable: true,
  allowHalfOpen: false,
  _bytesDispatched: 528,
  _sockname: null,
  _pendingData: null,
  _pendingEncoding: '',
  server: null,
  _server: null,
  _type: 'pipe',
  fd: 1,
  _isStdio: true,
  destroySoon: [Object],
  _destroy: [Object],
  [Symbol(asyncId)]: 10,
  [Symbol(bytesRead)]: 0 }

The returned value of console.log(process.stdout); without PM2:

WriteStream {
  connecting: false,
  _hadError: false,
  _handle: [Object],
  _parent: null,
  _host: null,
  _readableState: [Object],
  readable: false,
  domain: null,
  _events: [Object],
  _eventsCount: 4,
  _maxListeners: undefined,
  _writableState: [Object],
  writable: true,
  allowHalfOpen: false,
  _bytesDispatched: 100,
  _sockname: null,
  _writev: null,
  _pendingData: null,
  _pendingEncoding: '',
  server: null,
  _server: null,
  columns: 238, 
  rows: 61,
  _type: 'tty',
  fd: 1,
  _isStdio: true,
  destroySoon: [Function: destroy],
  _destroy: [Function],
  [Symbol(asyncId)]: 2,
  [Symbol(bytesRead)]: 0 }
0reactions
Qix-commented, Aug 21, 2017

Thanks for the confirm @CyberiumShadow.

Yeah, to be honest it sounds like supports-color was broken before v2 - this is actually intended behavior.

Please use FORCE_COLOR=1 if you need it. Remember that any time you run your script inside of a wrapper (e.g. PM2) where it spawns a new node process, it’s most likely going to cause isatty() to return 0 under the hood, causing process.stdout.isTTY to be false-ey.

You’re more than welcome to file a ticket over at PM2 to use pseudo-terminals upon spawning, but IIRC that’s a ton of work from the Node.js end and not cross-platform compatible.

Closing unless someone has reason to believe this is unintended functionality.

Thanks for the report and all of the correspondence.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Breaking? Broken more like!
Breaking? Broken more like! · Mirez · * · Webmaster · Posts: 3,920 · Make: Ford · Model: Galaxy Mk2 · Spec: 1.9...
Read more >
Multiplayer Game Hacking and Cheats - UnKnoWnCheaTs
UnKnoWnCheaTs - Multiplayer Game Hacking and Cheats. We encourage an open, free and collaborative environment for cheating in games.
Read more >
[ROM] PRIME! v1.6r2 | HC31 | Fast | Rooted | HMJ37 ... - XDA Forums
When can the nvflash version of PRIME! v1.5 be expected? ... are mostly about adfree breaking broken (it is fixed now with a...
Read more >
DCS 1.5 / 2.0 Updates discussion thread - SimHQ Forums
We are hard working about major issues of DCS 2.1.0. Today we decide released some of first fixes. DCS World CTD caused by...
Read more >
Metroid Dread update out now (version 2.1.0), patch notes
A new update is here for Metroid Dread, as Nintendo and MercurySteam have just released version 2.1.0. Patch notes have been shared.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found