fix eslint errors
This commit is contained in:
parent
1dbbfaf3ad
commit
6d9a3ad140
7 changed files with 59 additions and 51 deletions
|
|
@ -7,19 +7,19 @@ import { prompt, handleSIGINT } from '../src/util.js';
|
|||
// });
|
||||
handleSIGINT();
|
||||
|
||||
function onRawSIGINT(fn) {
|
||||
const { stdin, stdout } = process;
|
||||
stdin.setRawMode(true);
|
||||
stdin.resume();
|
||||
stdin.on('data', data => {
|
||||
const key = data.toString('utf-8');
|
||||
if (key === '\u0003') { // ctrl + c
|
||||
fn();
|
||||
} else {
|
||||
stdout.write(key);
|
||||
}
|
||||
});
|
||||
}
|
||||
// function onRawSIGINT(fn) {
|
||||
// const { stdin, stdout } = process;
|
||||
// stdin.setRawMode(true);
|
||||
// stdin.resume();
|
||||
// stdin.on('data', data => {
|
||||
// const key = data.toString('utf-8');
|
||||
// if (key === '\u0003') { // ctrl + c
|
||||
// fn();
|
||||
// } else {
|
||||
// stdout.write(key);
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// onRawSIGINT(() => {
|
||||
// console.log('raw'); process.exit(1);
|
||||
// });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue