mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-14 14:03:58 +00:00
cargo test: change directory to the build directory again
Some tests create files like "./test/test-home". Traditionally the did so in the first parent directory that contained tests/test.fish; so either a build directory or the root. The new rust version always changes directory to the root. This blows up when running with our docker/ files, which mount the source as read-only. Fix this by always changing directory to the build directory. In future we could extend this to not chdir if FISH_BUILD_DIR was not specified, to match traditional behavior. No strong opinions here.
This commit is contained in:
parent
7686c39d76
commit
6c2271a6da
1 changed files with 2 additions and 0 deletions
|
@ -34,6 +34,7 @@ pub mod prelude {
|
|||
use crate::{env::EnvStack, proc::proc_init};
|
||||
use once_cell::sync::Lazy;
|
||||
use once_cell::sync::OnceCell;
|
||||
use std::env::set_current_dir;
|
||||
use std::ffi::CString;
|
||||
use std::sync::Mutex;
|
||||
|
||||
|
@ -60,6 +61,7 @@ pub mod prelude {
|
|||
pub fn test_init() {
|
||||
static DONE: OnceCell<()> = OnceCell::new();
|
||||
DONE.get_or_init(|| {
|
||||
set_current_dir(env!("FISH_BUILD_DIR")).unwrap();
|
||||
{
|
||||
let s = CString::new("").unwrap();
|
||||
unsafe {
|
||||
|
|
Loading…
Reference in a new issue