Skip to content

Commit 3b33c31

Browse files
committed
feat(native): reflect windows support for crashpad-wait-for-upload in container usage
1 parent e16929a commit 3b33c31

File tree

1 file changed

+19
-2
lines changed
  • docs/platforms/native/advanced-usage/container-environments

1 file changed

+19
-2
lines changed

docs/platforms/native/advanced-usage/container-environments/index.mdx

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ sidebar_order: 2000
88
The Sentry Native SDK uses a [database path](https://docs.sentry.io/platforms/native/configuration/options/#database-path) to store events and crash reports. When you are using a containerized environment, you may want to mount a volume to persist the database across container restarts to avoid losing this data.
99

1010
## Waiting for `Crashpad` to Finish
11-
Starting with SDK version [0.8.3](https://github.com/getsentry/sentry-native/releases/tag/0.8.3), the [option `crashpad_wait_for_upload`](https://docs.sentry.io/platforms/native/configuration/options/#crashpad-wait-for-upload) allows the application (on Linux) to wait for the `crashpad_handler` to finish before a shutdown-after-crash.
11+
Starting with SDK version [0.8.3](https://github.com/getsentry/sentry-native/releases/tag/0.8.3) for Linux and [0.8.6](https://github.com/getsentry/sentry-native/releases/tag/0.8.6) for Windows, the [option `crashpad_wait_for_upload`](https://docs.sentry.io/platforms/native/configuration/options/#crashpad-wait-for-upload) allows the application to wait for the `crashpad_handler` to finish before a shutdown-after-crash.
1212

13-
In SDK versions older than 0.8.3, you could use a script similar to the example below to tie container shutdown to the `crashpad_handler` process:
13+
In SDK versions older than `0.8.3`/`0.8.6`, you could use a script similar to the example below to tie container shutdown to the `crashpad_handler` process:
1414
```bash
1515
#!/bin/bash
1616

@@ -29,3 +29,20 @@ if [ -n "$crashpad_pid" ]; then
2929
fi
3030
fi
3131
```
32+
on Linux, or for Windows PowerShell
33+
```powershell
34+
# Start-Process -FilePath ".\main-app.exe" -Wait
35+
36+
$crashpadTimeoutSec = 10
37+
$crashpadProcessName = "crashpad_handler"
38+
$crashpadProcess = Get-Process -Name $crashpadProcessName -ErrorAction SilentlyContinue | Sort-Object StartTime -Descending | Select-Object -First 1
39+
if ($null -ne $crashpadProcess) {
40+
Write-Output "Waiting for crashpad to finish..."
41+
$finished = $crashpadProcess.WaitForExit($crashpadTimeoutSec * 1000)
42+
if (-not $finished) {
43+
Write-Output "The crashpad process did not finish within $crashpadTimeoutSec seconds"
44+
} else {
45+
Write-Output "The crashpad process finished successfully"
46+
}
47+
}
48+
```

0 commit comments

Comments
 (0)