Fix allocating Buffer in early commit (#22379)

Summary:
Commit d9c2cdae41 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: https://github.com/facebook/react-native/pull/22379

Differential Revision: D13166867

Pulled By: hramos

fbshipit-source-id: 207528739889c044021a4b97ef94c33d56de3e89
This commit is contained in:
Radovan Šmitala 2018-11-22 00:47:59 -08:00 коммит произвёл Facebook Github Bot
Родитель 0a293a014b
Коммит 02a3517d0b
1 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -43,7 +43,7 @@ function create() {
process.stdin.setRawMode(true); process.stdin.setRawMode(true);
} }
var buf = Buffer.from(3); var buf = Buffer.alloc(3);
var str = '', var str = '',
character, character,
read; read;
@ -62,7 +62,7 @@ function create() {
insert = str.length; insert = str.length;
process.stdout.write('\u001b[2K\u001b[0G' + ask + str); process.stdout.write('\u001b[2K\u001b[0G' + ask + str);
process.stdout.write('\u001b[' + (insert + ask.length + 1) + 'G'); 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 continue; // any other 3 character sequence is ignored
} }