From c4bc7be20eee1b4987ffdaf80dabbbfca6a6a164 Mon Sep 17 00:00:00 2001 From: Charles Pierce Date: Tue, 7 Sep 2021 12:50:01 -0700 Subject: [PATCH] Pass yarn calls through to allow for Corepack where available --- crates/volta-core/src/run/yarn.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/crates/volta-core/src/run/yarn.rs b/crates/volta-core/src/run/yarn.rs index 86d36b13d..05b45ff31 100644 --- a/crates/volta-core/src/run/yarn.rs +++ b/crates/volta-core/src/run/yarn.rs @@ -43,13 +43,13 @@ pub(super) fn execution_context( ) -> Fallible<(OsString, ErrorKind)> { match platform { Some(plat) => { - validate_platform_yarn(&plat)?; + let on_failure = platform_yarn_error(&plat); let image = plat.checkout(session)?; let path = image.path()?; debug_active_image(&image); - Ok((path, ErrorKind::BinaryExecError)) + Ok((path, on_failure)) } None => { let path = System::path()?; @@ -59,13 +59,13 @@ pub(super) fn execution_context( } } -fn validate_platform_yarn(platform: &Platform) -> Fallible<()> { +fn platform_yarn_error(platform: &Platform) -> ErrorKind { match &platform.yarn { - Some(_) => Ok(()), + Some(_) => ErrorKind::BinaryExecError, None => match platform.node.source { - Source::Project => Err(ErrorKind::NoProjectYarn.into()), - Source::Default | Source::Binary => Err(ErrorKind::NoDefaultYarn.into()), - Source::CommandLine => Err(ErrorKind::NoCommandLineYarn.into()), + Source::Project => ErrorKind::NoProjectYarn, + Source::Default | Source::Binary => ErrorKind::NoDefaultYarn, + Source::CommandLine => ErrorKind::NoCommandLineYarn, }, } }