diff --git a/Cargo.toml b/Cargo.toml index 7cd4d9e745..6245e1386d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -66,7 +66,7 @@ predicates = "2.0.0" tempfile = "3.1.0" [features] -default = ["with_crash_reporting"] +default = [] managed = [] with_crash_reporting = [] diff --git a/src/commands/mod.rs b/src/commands/mod.rs index ca6b83116e..cd9a897331 100644 --- a/src/commands/mod.rs +++ b/src/commands/mod.rs @@ -283,8 +283,7 @@ fn setup() { } #[cfg(not(feature = "with_crash_reporting"))] { - static LOGGER: Logger = Logger; - log::set_logger(&Logger); + log::set_logger(&Logger).unwrap(); } } diff --git a/src/commands/react_native_xcode.rs b/src/commands/react_native_xcode.rs index 899d124205..994ee7d3e6 100644 --- a/src/commands/react_native_xcode.rs +++ b/src/commands/react_native_xcode.rs @@ -113,7 +113,6 @@ fn find_node() -> String { pub fn execute(matches: &ArgMatches<'_>) -> Result<(), Error> { let config = Config::current(); let (org, project) = config.get_org_and_project(matches)?; - let api = Api::current(); let should_wrap = matches.is_present("force") || match env::var("CONFIGURATION") { Ok(config) => !&config.contains("Debug"), @@ -183,6 +182,7 @@ pub fn execute(matches: &ArgMatches<'_>) -> Result<(), Error> { if !matches.is_present("force_foreground") { md.may_detach()?; } + let api = Api::current(); let url = url.trim_end_matches('/'); bundle_file = TempFile::create()?; bundle_path = bundle_file.path().to_path_buf(); @@ -282,6 +282,7 @@ pub fn execute(matches: &ArgMatches<'_>) -> Result<(), Error> { dist )); + let api = Api::current(); let release = api.new_release( &org, &NewRelease { diff --git a/src/commands/upload_dif.rs b/src/commands/upload_dif.rs index 928c742ab3..c244a65017 100644 --- a/src/commands/upload_dif.rs +++ b/src/commands/upload_dif.rs @@ -190,7 +190,6 @@ pub fn make_app<'a, 'b: 'a>(app: App<'a, 'b>) -> App<'a, 'b> { } fn execute_internal(matches: &ArgMatches<'_>, legacy: bool) -> Result<(), Error> { - let api = Api::current(); let config = Config::current(); let (org, project) = config.get_org_and_project(matches)?; @@ -298,6 +297,7 @@ fn execute_internal(matches: &ArgMatches<'_>, legacy: bool) -> Result<(), Error> // Execute the upload let (uploaded, has_processing_errors) = upload.upload()?; + let api = Api::current(); // Associate the dSYMs with the Info.plist data, if available if let Some(ref info_plist) = info_plist { diff --git a/src/utils/system.rs b/src/utils/system.rs index 851ff197d4..38ebe0300e 100644 --- a/src/utils/system.rs +++ b/src/utils/system.rs @@ -8,12 +8,20 @@ use lazy_static::lazy_static; use regex::{Captures, Regex}; use crate::config::Config; +#[cfg(not(windows))] +use crate::utils::xcode::launched_from_xcode; #[cfg(not(windows))] pub fn run_or_interrupt(f: F) where F: FnOnce() + Send + 'static, { + // See: https://github.com/getsentry/sentry-cli/pull/1104 + if launched_from_xcode() { + f(); + return; + } + let (tx, rx) = crossbeam_channel::bounded(100); let mut signals = signal_hook::iterator::Signals::new(&[ signal_hook::consts::SIGTERM, diff --git a/src/utils/xcode.rs b/src/utils/xcode.rs index f57075dcbc..44b9442059 100644 --- a/src/utils/xcode.rs +++ b/src/utils/xcode.rs @@ -427,6 +427,12 @@ pub fn launched_from_xcode() -> bool { false } +/// Returns true if we were invoked from xcode +#[cfg(not(target_os = "macos"))] +pub fn launched_from_xcode() -> bool { + false +} + /// Shows a dialog in xcode and blocks. The dialog will have a title and a /// message as well as the buttons "Show details" and "Ignore". Returns /// `true` if the `show details` button has been pressed.