2020-11-30 11:08:03 -05:00
|
|
|
Deno.setRaw(0, true);
|
|
|
|
Deno.setRaw(0, true, { cbreak: true }); // Can be called multiple times
|
|
|
|
|
|
|
|
const signal = Deno.signals.interrupt();
|
|
|
|
|
|
|
|
Deno.stdout.writeSync(new TextEncoder().encode("S"));
|
|
|
|
|
2021-06-25 00:15:35 -04:00
|
|
|
signal.then(() => {
|
|
|
|
Deno.stdout.writeSync(new TextEncoder().encode("A"));
|
2020-11-30 11:08:03 -05:00
|
|
|
|
2021-06-25 00:15:35 -04:00
|
|
|
signal.dispose();
|
2020-11-30 11:08:03 -05:00
|
|
|
|
2021-06-25 00:15:35 -04:00
|
|
|
Deno.setRaw(0, false); // restores old mode.
|
|
|
|
Deno.setRaw(0, false); // Can be safely called multiple times
|
|
|
|
});
|
2020-11-30 11:08:03 -05:00
|
|
|
|
2021-06-25 00:15:35 -04:00
|
|
|
setTimeout(() => {}, 10000); // Keep the program running
|