@@ -350,18 +350,17 @@ fn setup_panic_hook() {
350
350
eprintln ! ( "Args: {:?}" , env:: args( ) . collect:: <Vec <_>>( ) ) ;
351
351
eprintln ! ( ) ;
352
352
orig_hook ( panic_info) ;
353
- std :: process :: exit ( 1 ) ;
353
+ deno_runtime :: exit ( 1 ) ;
354
354
} ) ) ;
355
355
}
356
356
357
- #[ allow( clippy:: print_stderr) ]
358
357
fn exit_with_message ( message : & str , code : i32 ) -> ! {
359
- eprintln ! (
358
+ log :: error !(
360
359
"{}: {}" ,
361
360
colors:: red_bold( "error" ) ,
362
361
message. trim_start_matches( "error: " )
363
362
) ;
364
- std :: process :: exit ( code) ;
363
+ deno_runtime :: exit ( code) ;
365
364
}
366
365
367
366
fn exit_for_error ( error : AnyError ) -> ! {
@@ -380,13 +379,12 @@ fn exit_for_error(error: AnyError) -> ! {
380
379
exit_with_message ( & error_string, error_code) ;
381
380
}
382
381
383
- #[ allow( clippy:: print_stderr) ]
384
382
pub ( crate ) fn unstable_exit_cb ( feature : & str , api_name : & str ) {
385
- eprintln ! (
383
+ log :: error !(
386
384
"Unstable API '{api_name}'. The `--unstable-{}` flag must be provided." ,
387
385
feature
388
386
) ;
389
- std :: process :: exit ( 70 ) ;
387
+ deno_runtime :: exit ( 70 ) ;
390
388
}
391
389
392
390
pub fn main ( ) {
@@ -415,11 +413,13 @@ pub fn main() {
415
413
416
414
let result = create_and_run_current_thread_with_maybe_metrics ( future) ;
417
415
416
+ deno_runtime:: ops:: otel:: flush ( ) ;
417
+
418
418
#[ cfg( feature = "dhat-heap" ) ]
419
419
drop ( profiler) ;
420
420
421
421
match result {
422
- Ok ( exit_code) => std :: process :: exit ( exit_code) ,
422
+ Ok ( exit_code) => deno_runtime :: exit ( exit_code) ,
423
423
Err ( err) => exit_for_error ( err) ,
424
424
}
425
425
}
@@ -434,11 +434,16 @@ fn resolve_flags_and_init(
434
434
{
435
435
// Ignore results to avoid BrokenPipe errors.
436
436
let _ = err. print ( ) ;
437
- std :: process :: exit ( 0 ) ;
437
+ deno_runtime :: exit ( 0 ) ;
438
438
}
439
439
Err ( err) => exit_for_error ( AnyError :: from ( err) ) ,
440
440
} ;
441
441
442
+ if let Some ( otel_config) = flags. otel_config ( ) {
443
+ deno_runtime:: ops:: otel:: init ( otel_config) ?;
444
+ }
445
+ util:: logger:: init ( flags. log_level ) ;
446
+
442
447
// TODO(bartlomieju): remove in Deno v2.5 and hard error then.
443
448
if flags. unstable_config . legacy_flag_enabled {
444
449
log:: warn!(
@@ -467,7 +472,6 @@ fn resolve_flags_and_init(
467
472
deno_core:: JsRuntime :: init_platform (
468
473
None , /* import assertions enabled */ false ,
469
474
) ;
470
- util:: logger:: init ( flags. log_level ) ;
471
475
472
476
Ok ( flags)
473
477
}
0 commit comments