From 015b787d9f6d716fccdeac15b8659752d087a5e6 Mon Sep 17 00:00:00 2001 From: Nicholas Yang Date: Tue, 17 Jan 2023 17:07:54 -0500 Subject: [PATCH] fix(turborepo): Passing a relative path to --cwd when using --skip-infer. (#3348) Allows user to pass relative path to `--cwd` instead of erroring while using `--skip-infer` --- crates/turborepo-lib/src/cli.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crates/turborepo-lib/src/cli.rs b/crates/turborepo-lib/src/cli.rs index 6e3f0a763c32e..5f8fe52ad764d 100644 --- a/crates/turborepo-lib/src/cli.rs +++ b/crates/turborepo-lib/src/cli.rs @@ -3,6 +3,7 @@ use std::{env, io, mem, path::PathBuf, process}; use anyhow::{anyhow, Result}; use clap::{ArgAction, CommandFactory, Parser, Subcommand, ValueEnum}; use clap_complete::{generate, Shell}; +use dunce::canonicalize as fs_canonicalize; use log::error; use serde::Serialize; @@ -376,6 +377,10 @@ pub fn run(repo_state: Option) -> Result { clap_args.cwd = Some(repo_state.root); } + if let Some(cwd) = &clap_args.cwd { + clap_args.cwd = Some(fs_canonicalize(cwd)?); + } + match clap_args.command.as_ref().unwrap() { Command::Bin { .. } => { bin::run()?;