Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/context_server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ test-support = ["gpui/test-support"]
[dependencies]
anyhow.workspace = true
async-channel.workspace = true
async-process.workspace = true

Comment thread
rtfeldman marked this conversation as resolved.
Resolved
Comment thread
rtfeldman marked this conversation as resolved.
Resolved
async-trait.workspace = true
base64.workspace = true
collections.workspace = true
Expand Down
23 changes: 11 additions & 12 deletions crates/context_server/src/transport/stdio_transport.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
use std::path::PathBuf;
use std::pin::Pin;

use anyhow::{Context as _, Result};
use async_process::Child;
use anyhow::Result;
use async_trait::async_trait;
use futures::io::{BufReader, BufWriter};
use futures::{
AsyncBufReadExt as _, AsyncRead, AsyncWrite, AsyncWriteExt as _, Stream, StreamExt as _,
};
use gpui::AsyncApp;

use util::TryFutureExt as _;
use util::process::Child;
use util::shell::Shell;
use util::shell_builder::ShellBuilder;

Expand All @@ -31,22 +32,20 @@ impl StdioTransport {
) -> Result<Self> {
let builder = ShellBuilder::new(&Shell::System, cfg!(windows)).non_interactive();
let mut command =
builder.build_smol_command(Some(binary.executable.display().to_string()), &binary.args);
builder.build_std_command(Some(binary.executable.display().to_string()), &binary.args);

command
.envs(binary.env.unwrap_or_default())
.stdin(std::process::Stdio::piped())
.stdout(std::process::Stdio::piped())
.stderr(std::process::Stdio::piped())
.kill_on_drop(true);
command.envs(binary.env.unwrap_or_default());

if let Some(working_directory) = working_directory {
command.current_dir(working_directory);
}

let mut server = command
.spawn()
.with_context(|| format!("failed to spawn command {command:?})",))?;
let mut server = Child::spawn(
command,
std::process::Stdio::piped(),
std::process::Stdio::piped(),
std::process::Stdio::piped(),
)?;

let stdin = server.stdin.take().unwrap();
let stdout = server.stdout.take().unwrap();
Expand Down
5 changes: 1 addition & 4 deletions crates/project/src/context_server_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -605,10 +605,7 @@ impl ContextServerStore {

let server = state.server();
let configuration = state.configuration();
let mut result = Ok(());
if let ContextServerState::Running { server, .. } = &state {
result = server.stop();
}
let result = server.stop();
drop(state);

self.update_server_state(
Expand Down
Loading