Niterux
How do I make Deno run code when it is closed out on Windows
According to the documentation there is Deno.addSignalListener but it only handles on Windows when you use CTRL+C or CTRL+BREAK, how do I make it handle all possible closes like Deno.exit or closing it from the task bar?
4 replies
Questions about files and what happens when other programs writes to them
I am a noob at programming. There is this video game I play named Team Fortress 2 and it has this option called condebug which makes it create a file with all of the contents of the in-game console, this file is updated in realtime. I'm going to use this in deno to detect in-game button presses and team-changes to control VLC Media Player. I want to make a script with Deno that reads this file out in realtime and decodes it to perform actions when it sees certain groups of text, I am wondering what happens if Team Fortress 2 writes to the file at the same exact time that Deno tries to read it? Does my computer explode? Does Deno get some sort of incomplete output that would make my program mis-interpret what it read? Or does nothing bad happen at all? Also I'm wondering what Deno.close does, I want the file to be endlessly read until the script is closed, so do I repeatedly open and close the file or just keep it open until the script closes (is it even possible to close the file when the script closes?)?
56 replies