mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-04-23 09:08:36 +02:00
perf(cli): validate komorebi proc earlier on start
This is a small change to the start command which moves the check for the komorebi processes to come a little bit earlier. This small change will make running commands like "komorebic start --bar" around 3s faster when komorebi is already running.
This commit is contained in:
@@ -1990,8 +1990,14 @@ fn main() -> Result<()> {
|
|||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let mut system = sysinfo::System::new_all();
|
||||||
|
system.refresh_processes(ProcessesToUpdate::All);
|
||||||
|
|
||||||
let mut attempts = 0;
|
let mut attempts = 0;
|
||||||
let mut running = false;
|
let mut running = system
|
||||||
|
.processes_by_name("komorebi.exe".as_ref())
|
||||||
|
.next()
|
||||||
|
.is_some();
|
||||||
|
|
||||||
while !running && attempts <= 2 {
|
while !running && attempts <= 2 {
|
||||||
match powershell_script::run(&script) {
|
match powershell_script::run(&script) {
|
||||||
@@ -2006,7 +2012,6 @@ fn main() -> Result<()> {
|
|||||||
print!("Waiting for komorebi.exe to start...");
|
print!("Waiting for komorebi.exe to start...");
|
||||||
std::thread::sleep(Duration::from_secs(3));
|
std::thread::sleep(Duration::from_secs(3));
|
||||||
|
|
||||||
let mut system = sysinfo::System::new_all();
|
|
||||||
system.refresh_processes(ProcessesToUpdate::All);
|
system.refresh_processes(ProcessesToUpdate::All);
|
||||||
|
|
||||||
if system
|
if system
|
||||||
|
|||||||
Reference in New Issue
Block a user