Browse Source

update windows launcher to respect ETV_UI_PORT (#2065)

pull/2066/head
Jason Dove 18 hours ago committed by GitHub
parent
commit
1994f171d5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 8
      ErsatzTV-Windows/src/main.rs

8
ErsatzTV-Windows/src/main.rs

@ -1,6 +1,7 @@
#![windows_subsystem = "windows"] #![windows_subsystem = "windows"]
use special_folder::SpecialFolder; use special_folder::SpecialFolder;
use std::env;
use std::fs; use std::fs;
use std::os::windows::process::CommandExt; use std::os::windows::process::CommandExt;
use std::process::Child; use std::process::Child;
@ -21,11 +22,16 @@ fn main() {
let (tx, rx) = mpsc::channel(); let (tx, rx) = mpsc::channel();
tray.add_menu_item("Launch Web UI", || { tray.add_menu_item("Launch Web UI", || {
let ui_port = env::var("ETV_UI_PORT")
.ok()
.and_then(|val| val.parse::<u16>().ok())
.unwrap_or(8409);
let _ = Command::new("cmd") let _ = Command::new("cmd")
.creation_flags(CREATE_NO_WINDOW) .creation_flags(CREATE_NO_WINDOW)
.arg("/C") .arg("/C")
.arg("start") .arg("start")
.arg("http://localhost:8409") .arg(format!("http://localhost:{}", ui_port))
.stdin(Stdio::null()) .stdin(Stdio::null())
.stdout(Stdio::null()) .stdout(Stdio::null())
.stderr(Stdio::null()) .stderr(Stdio::null())

Loading…
Cancel
Save