ajout de Sheebr + support de shutdown + auto install kernel
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
//@ts-check
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {string} str
|
||||
* @returns
|
||||
*/
|
||||
async function input(str) {
|
||||
console.log(str)
|
||||
process.stdin.resume();
|
||||
process.stdin.setEncoding('utf8');
|
||||
let line = "";
|
||||
return new Promise((res, rej) => {
|
||||
process.stdin.on('data', function(chunk) {
|
||||
line += chunk
|
||||
if (chunk.toString('utf-8').endsWith('\n')) {
|
||||
process.stdin.pause()
|
||||
res(line.substring(0, line.length -1))
|
||||
}
|
||||
});
|
||||
process.stdin.on('error', function(err) {
|
||||
rej(err)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = input
|
||||
Reference in New Issue
Block a user