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

Output contains trailing whitespace when run under nodejs #2734

Closed
rfk opened this issue Aug 29, 2014 · 3 comments
Closed

Output contains trailing whitespace when run under nodejs #2734

rfk opened this issue Aug 29, 2014 · 3 comments

Comments

@rfk
Copy link
Contributor

rfk commented Aug 29, 2014

The fix committed in #2587 produces trailing whitespace in the program's output when run under nodejs:

$> cat test.c 
#include <stdio.h>
int main(void) {
  printf("hello world\n");
  return 0;
}
$> emcc -o test.js test.c
$> js test.js 
hello world
$> node test.js 
hello world

$>

This is probably OK most of the time, but it can cause problems if you need very precise output from the compiled program. For example, this is currently breaking my pypy.js build, because pypy configures itself by compiling test programs and parsing their output to learn various system details.

Can we make this workaround optional in some way? Is it still required on the very latest version of node, and if not can we disable it for versions where it's not needed?

@juj
Copy link
Collaborator

juj commented Aug 29, 2014

Hmm, indeed looking at the node.js issue tracker, the related issues are closed as fixed. I'll give this a look on Windows by building node from source, and see how it behaves.

Independent of that, we definitely can add some kind of conditional thing that allows skipping this behavior when it's considered harmful. Sorry for causing a regression for you here!

@kripken
Copy link
Member

kripken commented Aug 29, 2014

I'm not sure if it's needed on latest node or not. Anyhow, I added NODE_STDOUT_FLUSH_WORKAROUND to make this optional.

@juj
Copy link
Collaborator

juj commented Sep 7, 2014

The root problem does still occur in the latest node.js 0.10.31. I reported it fresh at nodejs/node-v0.x-archive#8329

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

No branches or pull requests

3 participants