From 7f03f33d6b320092fa59164c63f5b9160f3074ff Mon Sep 17 00:00:00 2001 From: Roey Darwish Dror Date: Mon, 11 Jan 2021 13:32:04 +0200 Subject: [PATCH] Skip dotnet when no SDK is installed (fix #592) (#597) --- src/steps/generic.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/steps/generic.rs b/src/steps/generic.rs index 91a3da16..70bad3fb 100644 --- a/src/steps/generic.rs +++ b/src/steps/generic.rs @@ -302,9 +302,16 @@ pub fn run_composer_update(ctx: &ExecutionContext) -> Result<()> { pub fn run_dotnet_upgrade(ctx: &ExecutionContext) -> Result<()> { let dotnet = utils::require("dotnet")?; - let output = Command::new(dotnet) - .args(&["tool", "list", "--global"]) - .check_output()?; + let output = Command::new(dotnet).args(&["tool", "list", "--global"]).output()?; + + if !output.status.success() { + return Err(SkipStep(format!("dotnet failed with exit code {:?}", output.status)).into()); + } + + let output = String::from_utf8(output.stdout)?; + if !output.starts_with("Package Id") { + return Err(SkipStep(String::from("dotnet did not output packages")).into()); + } let mut packages = output.split('\n').skip(2).filter(|line| !line.is_empty()).peekable();