Checking in progress, though not fully working as expected

This commit is contained in:
Ryan Ward
2026-07-27 11:41:20 -05:00
parent 856a6cd6f3
commit 309000a303
51 changed files with 74 additions and 3315 deletions
+1 -11
View File
@@ -99,15 +99,5 @@ pub(super) fn handle_write_log_request(level: log::Level, target: String, messag
// Write the log line that was forwarded from the terminal server.
log::log!(target: target.as_str(), level, "{message}");
};
cfg_if::cfg_if! {
if #[cfg(feature = "crash_reporting")] {
// Explicitly write the log line in the context of the main
// Sentry hub; this log receiver thread is spawned before
// Sentry is configured, so the thread-local hub doesn't
// have the appropriate client and scope configuration.
sentry::Hub::run(sentry::Hub::main(), log_fn);
} else {
log_fn();
}
}
log_fn();
}
+4 -23
View File
@@ -76,28 +76,9 @@ impl PtyHandle for DirectPtyHandle {
Ok(())
}
}
/// Invokes the provided callback function without crash reporting enabled.
fn invoke_without_crash_reporting<T>(
is_crash_reporting_enabled: bool,
func: impl FnOnce() -> T,
) -> T {
// Uninitialize cocoa-sentry before spawning the shell process to avoid passing any custom state
// (such as BSD signal handlers and mach exception handlers) into the shell process. This means
// we lose all Cocoa crash reports from now until when the session is successfully spawned,
// which is not ideal but allows us to fully ensure that we don't improperly leak any Sentry state
// into the child processes.
#[cfg(feature = "crash_reporting")]
crate::crash_reporting::uninit_cocoa_sentry();
let retval = func();
// Now that the child has spawned--reinitialize cocoa sentry.
if is_crash_reporting_enabled {
#[cfg(feature = "crash_reporting")]
crate::crash_reporting::init_cocoa_sentry();
}
retval
/// Invokes the provided callback function while spawning a shell process.
fn invoke_without_crash_reporting<T>(func: impl FnOnce() -> T) -> T {
func()
}
pub(super) struct PtySpawnInfo {
@@ -239,7 +220,7 @@ impl PtySpawner {
is_crash_reporting_enabled: bool,
) -> Result<(PtySpawnResult, Box<dyn PtyHandle>)> {
let pty_spawn_info =
invoke_without_crash_reporting(is_crash_reporting_enabled, move || {
invoke_without_crash_reporting(move || {
local_tty::spawn(
options,
#[cfg(windows)]
-20
View File
@@ -1435,26 +1435,6 @@ impl Session {
log::warn!(
"Failed to read history using PowerShell commands: {powershell_error:?}"
);
#[cfg(feature = "crash_reporting")]
sentry::with_scope(
|scope| {
let mut context = std::collections::BTreeMap::new();
context.insert(
"powershell_error".to_string(),
format!("{powershell_error:?}").into(),
);
scope.set_context(
"powershell_history",
sentry::protocol::Context::Other(context),
);
},
|| {
sentry::capture_message(
"Failed to read history using PowerShell commands",
sentry::Level::Error,
)
},
);
Ok(contents)
}
Err(e) => Err(ReadHistoryContentsError::PowerShellAndAsyncFsError {