Fix yarn (fix #403)

This commit is contained in:
Roey Darwish Dror
2020-05-10 06:45:39 +03:00
parent 6cddd57850
commit 9f8fbf6d65
2 changed files with 8 additions and 1 deletions

View File

@@ -236,6 +236,7 @@ impl Check for ExecutorExitStatus {
pub trait CommandExt { pub trait CommandExt {
/// Run the command, wait for it to complete, check the return code and decode the output as UTF-8. /// Run the command, wait for it to complete, check the return code and decode the output as UTF-8.
fn check_output(&mut self) -> Result<String>; fn check_output(&mut self) -> Result<String>;
fn string_output(&mut self) -> Result<String>;
} }
impl CommandExt for Command { impl CommandExt for Command {
@@ -248,4 +249,10 @@ impl CommandExt for Command {
} }
Ok(String::from_utf8(output.stdout)?) Ok(String::from_utf8(output.stdout)?)
} }
fn string_output(&mut self) -> Result<String> {
let output = self.output()?;
trace!("Output of {:?}: {:?}", self, output);
Ok(String::from_utf8(output.stdout)?)
}
} }

View File

@@ -53,7 +53,7 @@ pub fn run_npm_upgrade(_base_dirs: &BaseDirs, run_type: RunType) -> Result<()> {
pub fn yarn_global_update(run_type: RunType) -> Result<()> { pub fn yarn_global_update(run_type: RunType) -> Result<()> {
let yarn = require("yarn")?; let yarn = require("yarn")?;
let output = Command::new(&yarn).arg("version").check_output()?; let output = Command::new(&yarn).arg("version").string_output()?;
if output.contains("Hadoop") { if output.contains("Hadoop") {
debug!("Yarn is Hadoop yarn"); debug!("Yarn is Hadoop yarn");
return Err(SkipStep.into()); return Err(SkipStep.into());