I originally tried to implement this on Windows but wasn't able to get it working well. Closing the Stream Deck application works fine with Command::new("taskkill").args(&["/f", "/im", "StreamDeck.exe"]).status(), but reopening it had issues.
A proposed workaround (that works on stable rust) is to use some Windows-specific functions, but I don't have a Windows device to test on, and this flag is just a "nice to have" (the user can just close and reopen the application themselves) so I'll leave this one to someone else who wants to send a PR for it.
Another workaround is to have the CLI tool write a batch script that has the appropriate stop/start commands, and then execute that instead, but it feels very hacky
I originally tried to implement this on Windows but wasn't able to get it working well. Closing the Stream Deck application works fine with
Command::new("taskkill").args(&["/f", "/im", "StreamDeck.exe"]).status()
, but reopening it had issues.Doing it this way causes the CLI command to hang since it waits for
StreamDeck.exe
to return: https://github.com/walfie/streamdeck-youtube-emotes/blob/3e527e567a1f4ed0ae835b63bd48e53c06217361/src/main.rs#L242Doing it this way causes the error
Windows cannot find 'C:\Program'
: https://github.com/walfie/streamdeck-youtube-emotes/blob/106f0f77b55a662c7ea7e12e16a6e42fc391f370/src/main.rs#L199-L201Adding quotes around it doesn't work either (I guess it includes the quotes as part of the path?) https://github.com/walfie/streamdeck-youtube-emotes/blob/2a60a0c1ba4840b19aea19c8d96230921df50d1a/src/main.rs#L241-L243
Looks like it's related to a longstanding issue regarding escaping in Windows commands: https://github.com/rust-lang/rust/issues/29494 (The fix is only available on nightly)
A proposed workaround (that works on stable rust) is to use some Windows-specific functions, but I don't have a Windows device to test on, and this flag is just a "nice to have" (the user can just close and reopen the application themselves) so I'll leave this one to someone else who wants to send a PR for it.