On Linux, when the output of the js-yaml CLI is a pipe to another command, the output is truncated to the first 65536 bytes.
Here is how to reproduce (with any big enough YAML file):
$ wget http://static.snoyman.com/entries.yaml # A 190K YAML file
$ js-yaml entries.yaml > entries.json ; wc -c entries.json
$ js-yaml entries.yaml | wc -c
Tested with node v6.1.0 (arch: amd64) and js-yaml 3.6.0 with bash 4.3.11(1) on Ubuntu 14.04.
Hm... commenting out this line https://github.com/nodeca/js-yaml/blob/3.6.0/bin/js-yaml.js#L133 fixed the problem. Honestly, nobody cared too much about cli.
@ixty, blame shows this shit magic with process.exit() first happened in your commit 4 years ago :) . Do you have any ideas why?
@puzrin there's a typo in your reference @ixti
I don't understand how proper process exit status may be responsible.
But generally that particular line is not really important indeed.
Just love to be verbose ;)) sometimes...
It forces process exit while it still have data in pipe buffer.
So synchronous call behaves asynchronous... Terrific!
Anyway - just remove that line then.
Fix output cut on a pipe, closes #286
A flush on STDOUT before exit also would probably have fixed the issue. This is probably done by the stdlib before ending the process.
@dolmen do you know how to do that in node?
Isn't 0 the default exit code anyway?
@puzrin No I don't.
Thanks for the fix. I confirm the issue is closed in firstname.lastname@example.org.