GWicke has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/59943


Change subject: Only emit trailing newline if stdout is a TTY
......................................................................

Only emit trailing newline if stdout is a TTY

This fixes round-tripping and testing with pipelines like this:

echo 'foo' | node parse | node parse --html2wt

At the same time, it still prints the trailing newline when used from a shell.

Change-Id: I6f7f9703769b3326a2cb20e6afbcaf8363e0b912
---
M js/tests/parse.js
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Parsoid 
refs/changes/43/59943/1

diff --git a/js/tests/parse.js b/js/tests/parse.js
index a4cd02b..9d6c070 100755
--- a/js/tests/parse.js
+++ b/js/tests/parse.js
@@ -276,7 +276,7 @@
                 parserPipeline.on('document', function ( document ) {
                     var res, finishCb = function (trailingNL) {
                         stdout.write( res );
-                        if (trailingNL) {
+                        if (trailingNL && process.stdout.isTTY) {
                             stdout.write("\n");
                         }
                     };

-- 
To view, visit https://gerrit.wikimedia.org/r/59943
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6f7f9703769b3326a2cb20e6afbcaf8363e0b912
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Parsoid
Gerrit-Branch: master
Gerrit-Owner: GWicke <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to