Skip to content

Commit

Permalink
fix: should not hide cursor while press Ctrl + C in Windows OS
Browse files Browse the repository at this point in the history
  • Loading branch information
kabeep committed May 9, 2024
1 parent 365e32a commit 9696670
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions bin/cli.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,25 @@
#!/usr/bin/env node
import Exception from '@kabeep/exception';
import readline from 'node:readline';
import { hideBin } from 'yargs/helpers';
import yargs from 'yargs/yargs';
import pipeline, { type ArgumentVector, locale } from '../src/index.js';

if (process.platform === 'win32') {
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});

rl.on('SIGINT', function () {
process.emit('SIGINT');
});
}

process.on('SIGINT', function () {
process.exit(0);
});

pipeline(
yargs(hideBin(process.argv))
.scriptName('translate')
Expand Down

0 comments on commit 9696670

Please sign in to comment.