Skip to content

Commit f74049c

Browse files
committed
Remove --restart command on Windows (See #1)
1 parent 3e527e5 commit f74049c

File tree

1 file changed

+9
-19
lines changed

1 file changed

+9
-19
lines changed

src/main.rs

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -212,35 +212,25 @@ fn merge_manifests_if_exists(new_manifest: &mut Value, existing_path: &PathBuf)
212212
}
213213

214214
fn restart_stream_deck() -> Result<()> {
215-
if !cfg!(target_os = "macos") && !cfg!(target_os = "windows") {
216-
warn!("Ignoring restart flag, since the OS is not Windows or macOS");
215+
if !cfg!(target_os = "macos") {
216+
warn!(
217+
"The --restart flag is currently only supported on macOS. \
218+
See https://github.com/walfie/streamdeck-youtube-emotes/issues/1"
219+
);
217220
return Ok(());
218221
}
219222

220223
info!("Restarting Stream Deck application");
221224

222-
let stop_result = if cfg!(target_os = "macos") {
223-
Command::new("pkill").arg("Stream Deck").status()
224-
} else {
225-
Command::new("taskkill")
226-
.args(&["/f", "/im", "StreamDeck.exe"])
227-
.status()
228-
};
225+
let stop_result = Command::new("pkill").arg("Stream Deck").status();
229226

230227
if let Err(e) = stop_result {
231228
warn!(error = %e, "Failed to stop Stream Deck");
232229
}
233230

234-
let start_result = if cfg!(target_os = "macos") {
235-
Command::new("open")
236-
.arg("/Applications/Stream Deck.app")
237-
.status()
238-
} else {
239-
// Wait a bit to ensure that the Stream Deck application has actually closed
240-
std::thread::sleep(Duration::from_secs(2));
241-
242-
Command::new(r#"C:\Program Files\Elgato\StreamDeck\StreamDeck.exe"#).status()
243-
};
231+
let start_result = Command::new("open")
232+
.arg("/Applications/Stream Deck.app")
233+
.status();
244234

245235
if let Err(e) = start_result {
246236
warn!(error = %e, "Failed to start Stream Deck");

0 commit comments

Comments
 (0)