mirror of
https://github.com/actions/setup-java.git
synced 2025-04-20 18:06:45 +00:00
Fix.
This commit is contained in:
parent
596a6da241
commit
c1a589c5b6
7078 changed files with 1882834 additions and 319 deletions
52
node_modules/get-stdin/index.js
generated
vendored
Normal file
52
node_modules/get-stdin/index.js
generated
vendored
Normal file
|
@ -0,0 +1,52 @@
|
|||
'use strict';
|
||||
const {stdin} = process;
|
||||
|
||||
module.exports = () => {
|
||||
let result = '';
|
||||
|
||||
return new Promise(resolve => {
|
||||
if (stdin.isTTY) {
|
||||
resolve(result);
|
||||
return;
|
||||
}
|
||||
|
||||
stdin.setEncoding('utf8');
|
||||
|
||||
stdin.on('readable', () => {
|
||||
let chunk;
|
||||
|
||||
while ((chunk = stdin.read())) {
|
||||
result += chunk;
|
||||
}
|
||||
});
|
||||
|
||||
stdin.on('end', () => {
|
||||
resolve(result);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
module.exports.buffer = () => {
|
||||
const result = [];
|
||||
let length = 0;
|
||||
|
||||
return new Promise(resolve => {
|
||||
if (stdin.isTTY) {
|
||||
resolve(Buffer.concat([]));
|
||||
return;
|
||||
}
|
||||
|
||||
stdin.on('readable', () => {
|
||||
let chunk;
|
||||
|
||||
while ((chunk = stdin.read())) {
|
||||
result.push(chunk);
|
||||
length += chunk.length;
|
||||
}
|
||||
});
|
||||
|
||||
stdin.on('end', () => {
|
||||
resolve(Buffer.concat(result, length));
|
||||
});
|
||||
});
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue