Skip to content

Commit 737b7db

Browse files
committed
fix(daemon): auto-start
1 parent 3d32fbb commit 737b7db

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lua/xbase/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ pub fn is_running(_: &Lua, _: ()) -> LuaResult<bool> {
3333

3434
/// Ensure that daemon is currently running in background
3535
pub fn ensure(lua: &Lua, _: ()) -> LuaResult<bool> {
36-
// FIXME(dameon): resulting in connection refused
3736
if is_running(lua, ()).unwrap() {
3837
Ok(false)
39-
} else if Command::new(DAEMON_BINARY_PATH).spawn().is_ok() {
38+
} else {
39+
Command::new(DAEMON_BINARY_PATH).spawn().unwrap();
40+
// Give time for the daemon to be started
41+
std::thread::sleep(std::time::Duration::new(1, 0));
4042
lua.info("Spawned Background Server")?;
4143
Ok(true)
42-
} else {
43-
panic!("Unable to spawn background server");
4444
}
4545
}

0 commit comments

Comments
 (0)