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

fix: node.js debugger adds stderr (but exit code is 0) -> shouldn't throw #179

Merged
merged 2 commits into from Oct 8, 2022

Conversation

FuPeiJiang
Copy link
Contributor

nodejs/node-gyp#2719 (comment)


Debugger attached.
Waiting for the debugger to disconnect...

)
replacement = p_stdout.rstrip()
replacement = result.stdout.decode("utf-8").rstrip()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case, maybe concat stderr info too ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if it's merged, do I ignore this ?


concat stderr to what ?

to replacement ?
replacement = result.stdout.decode("utf-8").rstrip() + "\n" + result.stderr.decode("utf-8").rstrip()
the order will be changed, and I don't know how to keep original order as it appeared on screen


the original code did not concat stderr

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

original code do this in sys.stderr.write(p_stderr)

replacement = result.stdout.decode("utf-8").rstrip() + "\n" + result.stderr.decode("utf-8").rstrip()

Maybe put stderr first.

if it's merged, do I ignore this ?

you can do a new PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the original code is redundant:
it captures stderr,
stderr=subprocess.PIPE,
if stderr is not empty string
if p.wait() != 0 or p_stderr:
it writes it back to stderr
sys.stderr.write(p_stderr)
(it was only captured for condition checking)

the new code:
just don't capture it, stderr is written to stderr anyways

assuming replacement(stdout) is also written to stderr,
if you don't capture stderr, you don't have to concat it to stderr


Maybe put stderr first.

I don't see the point of this concatenation, what does it even change ?

@targos targos merged commit 1a457d9 into nodejs:main Oct 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants