Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
24 changes: 1 addition & 23 deletions app/src/terminal/local_tty/spawner.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use anyhow::Result;
#[cfg(unix)]
use warp_errors::report_error;
use warpui::{AppContext, Entity, SingletonEntity};
use warpui::{Entity, SingletonEntity};
#[cfg(unix)]
use {
crate::terminal::local_tty::server::TerminalServer, anyhow::bail, std::cmp::Reverse,
Expand All @@ -11,8 +11,6 @@ use {
#[cfg(target_os = "windows")]
use super::PseudoConsoleChild;
use super::{PtyOptions, PtySpawnResult};
use crate::send_telemetry_from_app_ctx;
use crate::server::telemetry::{PtySpawnMode, TelemetryEvent};
use crate::terminal::local_tty::{self};
/// A handle that can be used to interact with a pty process.
pub trait PtyHandle: Send + Sync {
Expand Down Expand Up @@ -176,13 +174,7 @@ impl PtySpawner {
#[cfg(windows)] event_loop_tx: super::mio_channel::Sender<
crate::terminal::writeable_pty::Message,
>,
ctx: &mut AppContext,
) -> Result<(PtySpawnResult, Box<dyn PtyHandle>)> {
#[cfg(not(unix))]
let is_fallback = false;
#[cfg(unix)]
let mut is_fallback = false;

#[cfg(unix)]
if let Some(server) = &self.server {
let result = Self::spawn_pty_via_server(server, options.clone());
Expand All @@ -206,25 +198,11 @@ impl PtySpawner {
report_error!(err.context(
"Failed to spawn pty via terminal server; falling back to spawning locally...",
));
is_fallback = true;
} else {
send_telemetry_from_app_ctx!(
TelemetryEvent::PtySpawned {
mode: PtySpawnMode::TerminalServer
},
ctx
);
return result;
}
}

let mode = if is_fallback {
PtySpawnMode::FallbackToDirect
} else {
PtySpawnMode::Direct
};
send_telemetry_from_app_ctx!(TelemetryEvent::PtySpawned { mode }, ctx);

Self::spawn_pty_directly(
options,
#[cfg(windows)]
Expand Down
4 changes: 2 additions & 2 deletions app/src/terminal/local_tty/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -603,8 +603,8 @@ impl Pty {
.context("error preparing signal handling")?;

let (PtySpawnResult { pid, leader_fd }, pty_handle) = PtySpawner::handle(ctx)
.update(ctx, |pty_spawner, ctx| {
pty_spawner.spawn_pty(options, is_crash_reporting_enabled, ctx)
.update(ctx, |pty_spawner, _| {
pty_spawner.spawn_pty(options, is_crash_reporting_enabled)
})?;

log::info!(
Expand Down
4 changes: 2 additions & 2 deletions app/src/terminal/local_tty/windows/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,8 @@ impl Pty {
) -> anyhow::Result<Self> {
let size = options.size;
PtySpawner::handle(ctx)
.update(ctx, |pty_spawner, ctx| {
pty_spawner.spawn_pty(options, is_crash_reporting_enabled, event_loop_tx, ctx)
.update(ctx, |pty_spawner, _| {
pty_spawner.spawn_pty(options, is_crash_reporting_enabled, event_loop_tx)
})
.map(
|(
Expand Down
Loading