Skip to content

Commit aa0976f

Browse files
committed
Fix cpkg run with custom bin path
Makes the `bin` path actually explicitly local to the project directory, which fixes `cpkg run` getting a "File not found" error.
1 parent 5739033 commit aa0976f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/main.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ fn main() -> anyhow::Result<()> {
397397

398398
std::process::Command::new(&temp_bin)
399399
.spawn()?;
400-
400+
401401
return Ok(());
402402
}
403403

@@ -423,12 +423,13 @@ fn main() -> anyhow::Result<()> {
423423
let vendor = target.join("vendor");
424424

425425
let out = if let Some(p) = config.package.bin {
426-
std::path::PathBuf::from(p)
426+
std::env::current_dir()?.join(p)
427427
} else {
428428
target.join(config.package.name)
429429
};
430430

431431
let b = compiler::try_locate()?;
432+
432433
b.compile(&main, &[src, &vendor], &out, &flags)?;
433434

434435
std::process::Command::new(out)

0 commit comments

Comments
 (0)