Skip to content

Commit

Permalink
Fix crash handler disable env
Browse files Browse the repository at this point in the history
  • Loading branch information
SamRodri committed Jul 8, 2024
1 parent ee29754 commit fa97c04
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,6 @@
"zng"
],
"lldb.launch.env": {
"NO_ZNG_CRASH_HANDLER": ""
"ZNG_NO_CRASH_HANDLER": ""
}
}
2 changes: 0 additions & 2 deletions crates/cargo-zng/src/l10n.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ pub struct L10nArgs {
check: bool,
}

// !!: TODO internal crates

pub fn run(mut args: L10nArgs) {
if !args.package.is_empty() && !args.manifest_path.is_empty() {
fatal!("only one of --package --manifest-path must be set")
Expand Down
8 changes: 1 addition & 7 deletions crates/zng-view/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -135,17 +135,11 @@ tempfile = "3.10"

[target.'cfg(target_os = "macos")'.dependencies.objc2-app-kit]
version = "0.2.2"
features = [
"NSEvent",
"NSAppearance",
"NSColor",
]
features = ["NSEvent", "NSAppearance", "NSColor", "NSColorSpace"]
[target.'cfg(target_os = "macos")'.dependencies.objc2-foundation]
version = "0.2.2"
features = ["NSString"]



[build-dependencies]
zng-tp-licenses = { path = "../zng-tp-licenses", version = "0.2.7", features = [
"build",
Expand Down
8 changes: 6 additions & 2 deletions crates/zng-view/src/config/macos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,13 @@ pub fn colors_config() -> ColorsConfig {

let accent = unsafe {
let a = NSColor::controlAccentColor();
Rgba::new(a.redComponent(), a.greenComponent(), a.blueComponent(), a.alphaComponent())
if let Some(a) = a.colorUsingColorSpace(&NSColorSpace::deviceRGBColorSpace()) {
Rgba::new(a.redComponent(), a.greenComponent(), a.blueComponent(), a.alphaComponent())
} else {
tracing::warn!("failed to determine macOS accent color");
ColorsConfig::default().accent
}
};

ColorsConfig { scheme, accent }
}

Expand Down
2 changes: 1 addition & 1 deletion crates/zng/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ pub use zng_ext_single_instance::{AppInstanceArgs, APP_INSTANCE_EVENT};
///
/// ```json
/// "lldb.launch.env": {
/// "NO_ZNG_CRASH_HANDLER": ""
/// "ZNG_NO_CRASH_HANDLER": ""
/// }
/// ```
///
Expand Down
3 changes: 3 additions & 0 deletions examples/headless/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ fn main() {
_ => headless::run(),
}
}

// let the caller or OS handle crashes (can also build without "crash_handler" default feature)
zng::app::crash_handler::crash_handler_config!(|cfg| cfg.no_crash_handler());
4 changes: 2 additions & 2 deletions tests/render-tests/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,9 @@ fn main() {
std::process::exit(101);
});

zng::env::init!();

let args = Args::parse();
if let Ok(vp) = env::var("RENDER_TESTS_VP") {
zng::env::init!();
return run(args, vp.into());
}

Expand All @@ -39,6 +38,7 @@ fn main() {
if args.include_vp(&view_process) {
let result = std::process::Command::new(std::env::current_exe().unwrap())
.env("ZNG_VIEW_NO_INIT_START", "")
.env("ZNG_NO_CRASH_HANDLER", "")
.env("RENDER_TESTS_VP", view_process)
.args(std::env::args().skip(1))
// .env("RUST_BACKTRACE", "1")
Expand Down

0 comments on commit fa97c04

Please sign in to comment.