mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-03-21 08:59:11 +01:00
fix(scoop): allow duplicate shim process
This commit addresses issues that users have been faced with when installing komorebi with scoop, which resulted in komorebi exiting almost immediately without providing any feedback as to what had happened. Scoop launches komorebi using an exe shim of the same name, which results in two komorebi.exe named processes running at the same time. This situation then fails the startup check which attempts to ensure that only one instance of komorebi.exe ever runs at any given time. The process startup check has been updated to allow for two komorebi.exe named processes to be running if one of them is recognised as a Scoop shim process. fix #95
This commit is contained in:
@@ -24,6 +24,7 @@ use lazy_static::lazy_static;
|
||||
use parking_lot::deadlock;
|
||||
use parking_lot::Mutex;
|
||||
use serde::Serialize;
|
||||
use sysinfo::ProcessExt;
|
||||
use sysinfo::SystemExt;
|
||||
use tracing_appender::non_blocking::WorkerGuard;
|
||||
use tracing_subscriber::layer::SubscriberExt;
|
||||
@@ -341,9 +342,20 @@ fn main() -> Result<()> {
|
||||
let mut system = sysinfo::System::new_all();
|
||||
system.refresh_processes();
|
||||
|
||||
if system.process_by_name("komorebi.exe").len() > 1 {
|
||||
tracing::error!("komorebi.exe is already running, please exit the existing process before starting a new one");
|
||||
std::process::exit(1);
|
||||
let matched_procs = system.process_by_name("komorebi.exe");
|
||||
|
||||
if matched_procs.len() > 1 {
|
||||
let mut shim_is_active = false;
|
||||
for proc in matched_procs {
|
||||
if proc.root().ends_with("shims") {
|
||||
shim_is_active = true;
|
||||
}
|
||||
}
|
||||
|
||||
if !shim_is_active {
|
||||
tracing::error!("komorebi.exe is already running, please exit the existing process before starting a new one");
|
||||
std::process::exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
// File logging worker guard has to have an assignment in the main fn to work
|
||||
|
||||
Reference in New Issue
Block a user