@@ -24,6 +24,8 @@ type PyDumpTracebackThreadsFn = unsafe extern "C" fn(
2424static mut DUMP_TRACEBACK_FN : Option < PyDumpTracebackThreadsFn > = None ;
2525static DUMP_TRACEBACK_INIT : std:: sync:: Once = std:: sync:: Once :: new ( ) ;
2626
27+ // Use raw system calls within signal handler context.
28+ // These direct C functions are preferred over going throughRust wrappers
2729extern "C" {
2830 fn pipe ( pipefd : * mut [ c_int ; 2 ] ) -> c_int ;
2931 fn read ( fd : c_int , buf : * mut c_void , count : usize ) -> isize ;
@@ -245,6 +247,7 @@ pub fn crashtracker_init<'py>(
245247 mut config : PyRefMut < ' py , CrashtrackerConfigurationPy > ,
246248 mut receiver_config : PyRefMut < ' py , CrashtrackerReceiverConfigPy > ,
247249 mut metadata : PyRefMut < ' py , CrashtrackerMetadataPy > ,
250+ emit_runtime_stacks : bool ,
248251) -> anyhow:: Result < ( ) > {
249252 INIT . call_once ( || {
250253 let ( config_opt, receiver_config_opt, metadata_opt) = (
@@ -256,8 +259,7 @@ pub fn crashtracker_init<'py>(
256259 if let ( Some ( config) , Some ( receiver_config) , Some ( metadata) ) =
257260 ( config_opt, receiver_config_opt, metadata_opt)
258261 {
259- let runtime_stacktrace_enabled = std:: env:: var ( "DD_CRASHTRACKER_EMIT_RUNTIME_STACKS" ) . unwrap_or_default ( ) ;
260- if runtime_stacktrace_enabled == "true" || runtime_stacktrace_enabled == "1" {
262+ if emit_runtime_stacks {
261263 unsafe {
262264 init_dump_traceback_fn ( ) ;
263265 }
0 commit comments