From 566bb030ec48ef2ee7f1e3281fd3340df81b41b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Drwi=C4=99ga?= Date: Fri, 24 Jun 2016 12:14:46 +0200 Subject: [PATCH] Fixing detecting if dapps are off --- parity/configuration.rs | 4 ++++ parity/main.rs | 4 ++-- parity/url.rs | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/parity/configuration.rs b/parity/configuration.rs index 4d201ffa8..e27ad3f2a 100644 --- a/parity/configuration.rs +++ b/parity/configuration.rs @@ -454,6 +454,10 @@ impl Configuration { x => x, }.into() } + + pub fn dapps_enabled(&self) -> bool { + !self.args.flag_dapps_off && !self.args.flag_no_dapps + } } #[cfg(test)] diff --git a/parity/main.rs b/parity/main.rs index de1d81b0b..26f7b45ac 100644 --- a/parity/main.rs +++ b/parity/main.rs @@ -264,7 +264,7 @@ fn execute_client(conf: Configuration, spec: Spec, client_config: ClientConfig) if conf.args.flag_webapp { println!("WARNING: Flag -w/--webapp is deprecated. Dapps server is now on by default. Ignoring."); } let dapps_server = dapps::new(dapps::Configuration { - enabled: !conf.args.flag_dapps_off && !conf.args.flag_no_dapps, + enabled: conf.dapps_enabled(), interface: conf.dapps_interface(), port: conf.args.flag_dapps_port, user: conf.args.flag_dapps_user.clone(), @@ -296,7 +296,7 @@ fn execute_client(conf: Configuration, spec: Spec, client_config: ClientConfig) service.register_io_handler(io_handler).expect("Error registering IO handler"); if conf.args.cmd_ui { - if conf.args.flag_dapps_off { + if !conf.dapps_enabled() { die_with_message("Cannot use UI command with Dapps turned off."); } url::open(&format!("http://{}:{}/", conf.dapps_interface(), conf.args.flag_dapps_port)); diff --git a/parity/url.rs b/parity/url.rs index 8ab6a2eda..4ba866241 100644 --- a/parity/url.rs +++ b/parity/url.rs @@ -55,5 +55,5 @@ pub fn open(url: &str) { #[cfg(target_os="linux")] pub fn open(url: &str) { use std; - let _ = std::process::Command::new("xdg-open").arg(url).output(); + let _ = std::process::Command::new("xdg-open").arg(url).spawn(); }