Skip to content

Commit

Permalink
Retrieve the crashpad_handler IPC endpoint from sentry-native (#40)
Browse files Browse the repository at this point in the history
After crashpad_handler has started, grab the endpoint of the pipe server that crashpad_handler is running, and stash it in an environment variable.

This method, and the name of envvar matches Chromium https://source.chromium.org/search?q=CHROME_CRASHPAD%20case:yes&sq=&ss=chromium which will allow the child process registration to work in the same way, and let the environment variable through the sandbox to child processes which otherwise have no environment.

Added to sentry-native here: thebrowsercompany/sentry-native#10.

Testing: manual via System Informer
  • Loading branch information
sgraham authored Apr 30, 2024
1 parent 8fec3bc commit 2b0e623
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Sources/SwiftSentry/SentrySDK.swift
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,17 @@ public enum SentrySDK {
}

sentry_init(o)

#if os(Windows)
let path = sentry_options_get_handler_ipc_pipew(o)

// It has to be this name rather than "SENTRY..." or "ARC..."
// because the Chromium sandbox is specially set up to allow this
// environment variable through to child processes.
"CHROME_CRASHPAD_PIPE_NAME".withCString(encodedAs: UTF16.self) {
SetEnvironmentVariableW($0, path)
}
#endif
}

public static func setUser(_ user: User?) {
Expand Down

0 comments on commit 2b0e623

Please sign in to comment.