2020-11-30 11:08:03 -05:00
|
|
|
Deno.setRaw(0, true);
|
|
|
|
Deno.setRaw(0, true, { cbreak: true }); // Can be called multiple times
|
|
|
|
|
2021-09-06 10:05:33 -04:00
|
|
|
const signal = Deno.signal("SIGINT");
|
2020-11-30 11:08:03 -05:00
|
|
|
|
|
|
|
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
|