mirror of
https://code.forgejo.org/actions/setup-node.git
synced 2025-05-20 05:14:44 +00:00
.
This commit is contained in:
parent
a004f0ae58
commit
fc725ba36b
7280 changed files with 19 additions and 1796407 deletions
52
node_modules/get-stdin/index.js
generated
vendored
52
node_modules/get-stdin/index.js
generated
vendored
|
@ -1,52 +0,0 @@
|
|||
'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