From 6ab03412eaa4e0be6a4aee4c8d74e735c50db7b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Drwi=C4=99ga?= Date: Fri, 10 Nov 2017 10:18:20 +0100 Subject: [PATCH] Fix js-glue. --- Cargo.lock | 28 ++++++++++++++-------------- dapps/js-glue/Cargo.toml | 2 +- dapps/js-glue/src/js.rs | 18 +++++++++--------- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ef424bae4..38801af79 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2001,6 +2001,20 @@ dependencies = [ [[package]] name = "parity-dapps-glue" version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "aster 0.41.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "mime_guess 2.0.0-alpha.2 (registry+https://github.com/rust-lang/crates.io-index)", + "quasi 0.32.0 (registry+https://github.com/rust-lang/crates.io-index)", + "quasi_codegen 0.32.0 (registry+https://github.com/rust-lang/crates.io-index)", + "syntex 0.58.1 (registry+https://github.com/rust-lang/crates.io-index)", + "syntex_syntax 0.58.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "parity-dapps-glue" +version = "1.9.1" dependencies = [ "aster 0.41.0 (registry+https://github.com/rust-lang/crates.io-index)", "clippy 0.0.103 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2013,20 +2027,6 @@ dependencies = [ "syntex_syntax 0.58.1 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "parity-dapps-glue" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "aster 0.41.0 (registry+https://github.com/rust-lang/crates.io-index)", - "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "mime_guess 2.0.0-alpha.2 (registry+https://github.com/rust-lang/crates.io-index)", - "quasi 0.32.0 (registry+https://github.com/rust-lang/crates.io-index)", - "quasi_codegen 0.32.0 (registry+https://github.com/rust-lang/crates.io-index)", - "syntex 0.58.1 (registry+https://github.com/rust-lang/crates.io-index)", - "syntex_syntax 0.58.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "parity-hash-fetch" version = "1.9.0" diff --git a/dapps/js-glue/Cargo.toml b/dapps/js-glue/Cargo.toml index 76c5457d7..4cad9cdab 100644 --- a/dapps/js-glue/Cargo.toml +++ b/dapps/js-glue/Cargo.toml @@ -1,7 +1,7 @@ [package] description = "Base Package for all Parity built-in dapps" name = "parity-dapps-glue" -version = "1.9.0" +version = "1.9.1" license = "GPL-3.0" authors = ["Parity Technologies "] build = "build.rs" diff --git a/dapps/js-glue/src/js.rs b/dapps/js-glue/src/js.rs index 49ccdd26f..d1d1cdda9 100644 --- a/dapps/js-glue/src/js.rs +++ b/dapps/js-glue/src/js.rs @@ -25,7 +25,7 @@ mod platform { use std::process::Command; pub static NPM_CMD: &'static str = "npm"; - pub fn handle_fd(cmd: &mut Command) -> &mut Command { + pub fn handle_cmd(cmd: &mut Command) -> &mut Command { cmd } } @@ -34,14 +34,14 @@ mod platform { mod platform { use std::process::{Command, Stdio}; - pub static NPM_CMD: &'static str = "npm.cmd"; + pub static NPM_CMD: &'static str = "cmd.exe"; // NOTE [ToDr] For some reason on windows - // We cannot have any file descriptors open when running a child process - // during build phase. - pub fn handle_fd(cmd: &mut Command) -> &mut Command { + // The command doesn't have %~dp0 set properly + // and it cannot load globally installed node.exe + pub fn handle_cmd(cmd: &mut Command) -> &mut Command { cmd.stdin(Stdio::null()) - .stdout(Stdio::null()) - .stderr(Stdio::null()) + .arg("/c") + .arg("npm.cmd") } } @@ -58,7 +58,7 @@ pub fn build(_path: &str, _dest: &str) { #[cfg(not(feature = "use-precompiled-js"))] pub fn build(path: &str, dest: &str) { - let child = platform::handle_fd(&mut Command::new(platform::NPM_CMD)) + let child = platform::handle_cmd(&mut Command::new(platform::NPM_CMD)) .arg("install") .arg("--no-progress") .current_dir(path) @@ -66,7 +66,7 @@ pub fn build(path: &str, dest: &str) { .unwrap_or_else(|e| die("Installing node.js dependencies with npm", e)); assert!(child.success(), "There was an error installing dependencies."); - let child = platform::handle_fd(&mut Command::new(platform::NPM_CMD)) + let child = platform::handle_cmd(&mut Command::new(platform::NPM_CMD)) .arg("run") .arg("build") .env("NODE_ENV", "production")