~krathalan/wtwitch-rust

eb82d39e0f0d0c9c44b22e98b24498d98a2716af — Hunter Peavey 4 years ago f0c3720
Panic with streamlink on windows
1 files changed, 5 insertions(+), 5 deletions(-)

M src/main.rs
M src/main.rs => src/main.rs +5 -5
@@ 3,6 3,8 @@ use std::fs;
use std::io::prelude::*;
use std::path::Path;

const PROGRAM_NAME: &str = "wtwitch";

// Twitch API information
// This API key is intended to be used for wtwitch only -- do not use this API
// key for any other reason!


@@ 149,16 151,14 @@ fn watch(args: Vec<String>) {
    use std::process;

    if cfg!(target_os = "windows") {
        process::Command::new("cmd")
                .args(&["/C", "echo hello"])
                .spawn()
                .expect("failed to execute process")
        panic!("{} does not yet support launching a stream on Windows", PROGRAM_NAME);
    } else {
        let streamlink_command = format!("streamlink -p mpv --twitch-disable-ads \"https://www.twitch.tv/{}\" best", args[2]);
        process::Command::new("sh")
                .arg("-c")
                .arg(streamlink_command)
                .stdout(process::Stdio::null())
                .spawn()
                .expect("failed to execute process")
                .expect("Failed to open streamlink")
    };
}
\ No newline at end of file