refactor(yarn): remove unnecessary Yarn::yarn field
This commit is contained in:
@@ -117,15 +117,11 @@ impl NPM {
|
|||||||
|
|
||||||
struct Yarn {
|
struct Yarn {
|
||||||
command: PathBuf,
|
command: PathBuf,
|
||||||
yarn: Option<PathBuf>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Yarn {
|
impl Yarn {
|
||||||
fn new(command: PathBuf) -> Self {
|
fn new(command: PathBuf) -> Self {
|
||||||
Self {
|
Self { command }
|
||||||
command,
|
|
||||||
yarn: require("yarn").ok(),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn has_global_subcmd(&self) -> bool {
|
fn has_global_subcmd(&self) -> bool {
|
||||||
@@ -153,8 +149,7 @@ impl Yarn {
|
|||||||
|
|
||||||
if use_sudo {
|
if use_sudo {
|
||||||
let sudo = ctx.require_sudo()?;
|
let sudo = ctx.require_sudo()?;
|
||||||
let command = self.yarn.as_ref().unwrap_or(&self.command);
|
sudo.execute(ctx, &self.command)?.args(args).status_checked()?;
|
||||||
sudo.execute(ctx, command)?.args(args).status_checked()?;
|
|
||||||
} else {
|
} else {
|
||||||
ctx.execute(&self.command).args(args).status_checked()?;
|
ctx.execute(&self.command).args(args).status_checked()?;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user