Skip to content

Commit

Permalink
Fix allocating Buffer in early commit (#22379)
Browse files Browse the repository at this point in the history
Summary:
Commit d9c2cda brings compatibility with Node 10, but replaced allocating buffer incorrectly.
dulmandakh made two comments and shows how to do it based on NodeJS documentation https://nodejs.org/api/buffer.html#buffer_new_buffer_size

This PR just fixes that commit.
Pull Request resolved: #22379

Differential Revision: D13166867

Pulled By: hramos

fbshipit-source-id: 207528739889c044021a4b97ef94c33d56de3e89
  • Loading branch information
radeno authored and facebook-github-bot committed Nov 22, 2018
1 parent 0a293a0 commit 02a3517
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions local-cli/generator/promptSync.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function create() {
process.stdin.setRawMode(true);
}

var buf = Buffer.from(3);
var buf = Buffer.alloc(3);
var str = '',
character,
read;
Expand All @@ -62,7 +62,7 @@ function create() {
insert = str.length;
process.stdout.write('\u001b[2K\u001b[0G' + ask + str);
process.stdout.write('\u001b[' + (insert + ask.length + 1) + 'G');
buf = Buffer.from(3);
buf = Buffer.alloc(3);
}
continue; // any other 3 character sequence is ignored
}
Expand Down

0 comments on commit 02a3517

Please sign in to comment.