Skip to content

Commit

Permalink
Use a better clear console sequence (facebook#1211)
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon authored and alexdriaguine committed Jan 23, 2017
1 parent 837e6b4 commit fc582da
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions packages/react-dev-utils/clearConsole.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,8 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

var isFirstClear = true;
function clearConsole() {
// On first run, clear completely so it doesn't show half screen on Windows.
// On next runs, use a different sequence that properly scrolls back.
process.stdout.write(isFirstClear ? '\x1bc' : '\x1b[2J\x1b[0f');
isFirstClear = false;
process.stdout.write(process.platform === 'win32' ? '\x1Bc' : '\x1B[2J\x1B[3J\x1B[H');
}

module.exports = clearConsole;

0 comments on commit fc582da

Please sign in to comment.