Skip to content

Commit 5475b37

Browse files
committed
temporary windows support
1 parent 4577bce commit 5475b37

File tree

4 files changed

+25
-1
lines changed

4 files changed

+25
-1
lines changed

config/config.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ ips = [
44
[192,168,13,100], # pablo
55
[192,168,13,69], # andreas
66
[192,168,13,42], # also andreas
7+
[192,168,13,48], # testing laptop
78
]
89
force = true
910
port = 6949

crates/main/src/matching_methods.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ pub fn match_can_id_to_event(id: u32, payload: &[u8]) -> Event {
5353
Event::LeviSystemCheckSuccess
5454
} else {
5555
error!("Different system check payload for levi: {}", payload[0]);
56-
Event::LeviSystemCheckSuccess // TODO: change this back to failure
56+
Event::LeviSystemCheckSuccess // TODO: change this back to
57+
// failure
5758
}
5859
}
5960

gs/station/src/tui/app.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#![allow(clippy::manual_flatten)]
22
use std::collections::BTreeMap;
33
use std::io::BufRead;
4+
#[cfg(unix)]
45
use std::os::unix::process::CommandExt;
56
use std::path::PathBuf;
67
use std::process::Child;
@@ -56,6 +57,7 @@ impl App {
5657
let manifest_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
5758
let gui_dir = manifest_dir.parent().expect("ooga booga").to_path_buf();
5859

60+
#[cfg(unix)]
5961
let mut child = unsafe {
6062
std::process::Command::new("npm")
6163
.current_dir(&gui_dir)
@@ -70,6 +72,17 @@ impl App {
7072
.spawn()
7173
.expect("Failed to spawn gui")
7274
};
75+
// #[cfg(windows)]
76+
let mut child = std::process::Command::new("npm")
77+
.current_dir(&gui_dir)
78+
.args(["run", "gui"])
79+
.stdout(Stdio::piped())
80+
.stderr(Stdio::piped())
81+
.spawn()
82+
.map_err(|e| {
83+
format!("could not run command `{} npm run gui`: {e:?}", gui_dir.display())
84+
})
85+
.expect("Failed to spawn gui");
7386

7487
let map = BTreeMap::new();
7588

gs/station/src/tui/main.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ use std::io::Stdout;
77
use std::process::Child;
88

99
use crossterm::execute;
10+
#[cfg(unix)]
1011
use nix::libc::killpg;
12+
#[cfg(unix)]
1113
use nix::unistd::Pid;
1214
use ratatui::prelude::*;
1315

@@ -36,6 +38,7 @@ fn main() -> anyhow::Result<()> {
3638
Ok(())
3739
}
3840

41+
#[cfg(unix)]
3942
fn kill_tree(child: &mut Child) {
4043
let pgid = Pid::from_raw(child.id() as i32);
4144
// send SIGTERM to the whole group
@@ -51,3 +54,9 @@ fn kill_tree(child: &mut Child) {
5154
// this will also reap zombies of its children
5255
let _ = child.wait();
5356
}
57+
58+
#[cfg(windows)]
59+
fn kill_tree(child: &mut Child) {
60+
child.kill().unwrap();
61+
child.wait().unwrap();
62+
}

0 commit comments

Comments
 (0)