From 2e34f6f9a80678f557413eee87b7218b46e32b78 Mon Sep 17 00:00:00 2001 From: Adam Ernst Date: Fri, 12 Jan 2018 13:00:51 -0800 Subject: [PATCH] Add a flush() function to Terminal Reviewed By: yungsters Differential Revision: D6713011 fbshipit-source-id: 05afd49e4099301124d83e1b345d7b40a9c84c73 --- packages/metro-core/src/Terminal/Terminal.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/metro-core/src/Terminal/Terminal.js b/packages/metro-core/src/Terminal/Terminal.js index d74e54ac..830e4f9f 100644 --- a/packages/metro-core/src/Terminal/Terminal.js +++ b/packages/metro-core/src/Terminal/Terminal.js @@ -169,6 +169,13 @@ class Terminal { this.log(this._nextStatusStr); this._nextStatusStr = ''; } + + flush(): void { + // Useful if you're going to start calling console.log/console.error directly + // again; otherwise you could end up with mangled output when the queued + // update starts writing to stream after a delay. + this._scheduleUpdate.flush(); + } } module.exports = Terminal;