mirror of
https://github.com/zed-industries/zed.git
synced 2025-02-05 10:20:51 +00:00
remote server: Add more debug logging (#18855)
Closes #ISSUE Release Notes: - N/A
This commit is contained in:
parent
f0566d54eb
commit
b2eb439f32
1 changed files with 13 additions and 2 deletions
|
@ -106,6 +106,7 @@ fn start_server(
|
||||||
cx.on_app_quit(move |_| {
|
cx.on_app_quit(move |_| {
|
||||||
let mut app_quit_tx = app_quit_tx.clone();
|
let mut app_quit_tx = app_quit_tx.clone();
|
||||||
async move {
|
async move {
|
||||||
|
log::info!("app quitting. sending signal to server main loop");
|
||||||
app_quit_tx.send(()).await.ok();
|
app_quit_tx.send(()).await.ok();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -195,6 +196,13 @@ fn start_server(
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn execute_run(pid_file: PathBuf, stdin_socket: PathBuf, stdout_socket: PathBuf) -> Result<()> {
|
pub fn execute_run(pid_file: PathBuf, stdin_socket: PathBuf, stdout_socket: PathBuf) -> Result<()> {
|
||||||
|
log::info!(
|
||||||
|
"server: starting up. pid_file: {:?}, stdin_socket: {:?}, stdout_socket: {:?}",
|
||||||
|
pid_file,
|
||||||
|
stdin_socket,
|
||||||
|
stdout_socket
|
||||||
|
);
|
||||||
|
|
||||||
write_pid_file(&pid_file)
|
write_pid_file(&pid_file)
|
||||||
.with_context(|| format!("failed to write pid file: {:?}", &pid_file))?;
|
.with_context(|| format!("failed to write pid file: {:?}", &pid_file))?;
|
||||||
|
|
||||||
|
@ -202,10 +210,12 @@ pub fn execute_run(pid_file: PathBuf, stdin_socket: PathBuf, stdout_socket: Path
|
||||||
let stdout_listener =
|
let stdout_listener =
|
||||||
UnixListener::bind(stdout_socket).context("failed to bind stdout socket")?;
|
UnixListener::bind(stdout_socket).context("failed to bind stdout socket")?;
|
||||||
|
|
||||||
|
log::debug!("server: starting gpui app");
|
||||||
gpui::App::headless().run(move |cx| {
|
gpui::App::headless().run(move |cx| {
|
||||||
settings::init(cx);
|
settings::init(cx);
|
||||||
HeadlessProject::init(cx);
|
HeadlessProject::init(cx);
|
||||||
|
|
||||||
|
log::info!("server: gpui app started, initializing server");
|
||||||
let session = start_server(stdin_listener, stdout_listener, cx);
|
let session = start_server(stdin_listener, stdout_listener, cx);
|
||||||
let project = cx.new_model(|cx| {
|
let project = cx.new_model(|cx| {
|
||||||
HeadlessProject::new(session, Arc::new(RealFs::new(Default::default(), None)), cx)
|
HeadlessProject::new(session, Arc::new(RealFs::new(Default::default(), None)), cx)
|
||||||
|
@ -343,8 +353,9 @@ fn write_pid_file(path: &Path) -> Result<()> {
|
||||||
if path.exists() {
|
if path.exists() {
|
||||||
std::fs::remove_file(path)?;
|
std::fs::remove_file(path)?;
|
||||||
}
|
}
|
||||||
|
let pid = std::process::id().to_string();
|
||||||
std::fs::write(path, std::process::id().to_string()).context("Failed to write PID file")
|
log::debug!("server: writing PID {} to file {:?}", pid, path);
|
||||||
|
std::fs::write(path, pid).context("Failed to write PID file")
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn handle_io<R, W>(mut reader: R, mut writer: W, socket_name: &str) -> Result<()>
|
async fn handle_io<R, W>(mut reader: R, mut writer: W, socket_name: &str) -> Result<()>
|
||||||
|
|
Loading…
Reference in a new issue