Skip to content

Commit 8740686

Browse files
committed
Replace $PWD with $OUT_DIR
env::var OUT_DIR will always available at build time
1 parent 8bd633a commit 8740686

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

azure-pipelines.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ steps:
4646
curl -sSf -o rustup-init.exe https://win.rustup.rs
4747
rustup-init.exe -y --default-toolchain %RUSTUP_TOOLCHAIN%
4848
echo "##vso[task.setvariable variable=PATH;]%PATH%;%USERPROFILE%\.cargo\bin"
49-
echo "##vso[task.setvariable variable=PATH;]%cd%"
5049
displayName: Windows install rust
5150
condition: eq( variables['Agent.OS'], 'Windows_NT' )
5251
- script: |

packages/cli/build.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,23 @@
22

33
extern crate clap;
44
use clap::Shell::*;
5-
use std::{env, path::Path};
5+
use std::{env, error::Error, path::Path};
66

77
#[cfg(not(debug_assertions))]
88
include!("src/lib.rs");
99

1010
#[cfg(not(debug_assertions))]
11-
fn main() {
11+
fn main() -> Result<(), Box<dyn Error>> {
12+
let ref out_dir = Path::new(&env::var("OUT_DIR")?).join("../../../");
13+
1214
let mut app = cli::build();
13-
let ref out_dir = Path::new(env!("PWD")).join("target/release");
1415
let mut generate_completions = |shell| app.gen_completions(env!("CARGO_PKG_NAME"), shell, out_dir);
1516

1617
for shell in &[Bash, Fish, Zsh, PowerShell, Elvish] {
1718
generate_completions(*shell);
1819
}
20+
21+
Ok(())
1922
}
2023

2124
#[cfg(debug_assertions)]

0 commit comments

Comments
 (0)