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

Request: Add small note in README for using debug in child processes #811

Closed
aaarichter opened this issue Feb 9, 2021 · 3 comments · Fixed by #850
Closed

Request: Add small note in README for using debug in child processes #811

aaarichter opened this issue Feb 9, 2021 · 3 comments · Fixed by #850
Labels
help-wanted This issue has an actionable item pr-welcome This issue has an approved change; a pull request would be appreciated

Comments

@aaarichter
Copy link

Hi,

Due to the process.isTTY check, it can happen that colors are not shown in child process when stderr is piped.

chalk/supports-color#94 (comment) gave an easy solution to fix this problem.
Request: It would be nice if the readme would mention this workaround.

example code from my project, where a worker with the actual server is forked and passed to node repl. Without setting DEBUG_COLORS: 1, there won't be any colors 😿 .

worker = fork(WORKER_WRAP_PATH, [workerPath], {
  stdio: [
    /* stdin: */ 0,
    /* stdout: */ 'pipe',
    /* stderr: */ 'pipe',
    'ipc',
  ],
  env: Object.assign({}, process.env, {
    DEBUG_COLORS: 1 // without this settings, colors won't be shown
  }),
});

worker.stderr.pipe(process.stderr, { end: false });
@srivalli630

This comment has been minimized.

1 similar comment
@xiaoly10

This comment has been minimized.

@Qix-
Copy link
Member

Qix- commented Sep 12, 2021

PR welcome

@Qix- Qix- added help-wanted This issue has an actionable item pr-welcome This issue has an approved change; a pull request would be appreciated labels Sep 12, 2021
kristofkalocsai added a commit to kristofkalocsai/debug that referenced this issue Oct 3, 2021
code example and original request copied from @
aaarichter
debug-js#811
kristofkalocsai added a commit to kristofkalocsai/debug that referenced this issue Oct 3, 2021
code example and original request copied from @aaarichter
should close debug-js#811
@Qix- Qix- closed this as completed in #850 Oct 13, 2021
Qix- added a commit that referenced this issue Oct 13, 2021
* adds README section regarding usage in child procs

code example and original request copied from @aaarichter
should close #811

* Update README.md

Co-authored-by: Qix <Qix-@users.noreply.github.com>

Co-authored-by: Qix <Qix-@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help-wanted This issue has an actionable item pr-welcome This issue has an approved change; a pull request would be appreciated
Development

Successfully merging a pull request may close this issue.

4 participants