Use Buffer.alloc
if it is available.
This commit is contained in:
parent
5f5492ce0c
commit
8c78b18e58
1 changed files with 5 additions and 1 deletions
|
@ -361,7 +361,11 @@ function _readlineSync(options) {
|
||||||
input = tryExt();
|
input = tryExt();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
buffer = new Buffer((reqSize = options.keyIn ? 1 : options.bufferSize));
|
if (Buffer.alloc) {
|
||||||
|
buffer = Buffer.alloc((reqSize = options.keyIn ? 1 : options.bufferSize));
|
||||||
|
} else {
|
||||||
|
buffer = new Buffer((reqSize = options.keyIn ? 1 : options.bufferSize));
|
||||||
|
}
|
||||||
|
|
||||||
if (options.keyIn && options.limit) {
|
if (options.keyIn && options.limit) {
|
||||||
limit = new RegExp('[^' + options.limit + ']',
|
limit = new RegExp('[^' + options.limit + ']',
|
||||||
|
|
Loading…
Reference in a new issue