Added workspace restart command
This commit is contained in:
@@ -18,6 +18,7 @@ clap = { version = "3.1", features = ["derive"] }
|
||||
dirs = "3.0"
|
||||
ipc-channel = "0.16"
|
||||
serde = { version = "1.0", features = ["derive", "rc"] }
|
||||
sysinfo = "0.27"
|
||||
|
||||
[target.'cfg(target_os = "macos")'.dependencies]
|
||||
core-foundation = "0.9"
|
||||
|
||||
+12
-1
@@ -14,8 +14,10 @@ use std::{
|
||||
fs::{self, OpenOptions},
|
||||
io,
|
||||
path::{Path, PathBuf},
|
||||
ptr,
|
||||
ptr, thread,
|
||||
time::Duration,
|
||||
};
|
||||
use sysinfo::{Pid, System, SystemExt};
|
||||
|
||||
#[derive(Parser)]
|
||||
#[clap(name = "zed", global_setting(clap::AppSettings::NoAutoVersion))]
|
||||
@@ -32,6 +34,8 @@ struct Args {
|
||||
/// Custom Zed.app path
|
||||
#[clap(short, long)]
|
||||
bundle_path: Option<PathBuf>,
|
||||
#[clap(short, long)]
|
||||
restart_from: Option<Pid>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
@@ -60,6 +64,13 @@ fn main() -> Result<()> {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
if let Some(parent_pid) = args.restart_from {
|
||||
let mut system = System::new();
|
||||
while system.refresh_process(parent_pid) {
|
||||
thread::sleep(Duration::from_millis(100));
|
||||
}
|
||||
}
|
||||
|
||||
for path in args.paths.iter() {
|
||||
if !path.exists() {
|
||||
touch(path.as_path())?;
|
||||
|
||||
Reference in New Issue
Block a user