Skip to content

Commit 9c23551

Browse files
d3lmyouknowone
authored andcommitted
Add ability to initialize cwd from PWD when targeting WASI
1 parent d5a6284 commit 9c23551

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/lib.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,13 @@ pub use settings::{opts_with_clap, RunMode};
6363
pub fn run(init: impl FnOnce(&mut VirtualMachine) + 'static) -> ExitCode {
6464
env_logger::init();
6565

66+
#[cfg(target_os = "wasi")]
67+
{
68+
if let Ok(pwd) = env::var("PWD") {
69+
let _ = env::set_current_dir(pwd);
70+
};
71+
}
72+
6673
let (settings, run_mode) = opts_with_clap();
6774

6875
// Be quiet if "quiet" arg is set OR stdin is not connected to a terminal

0 commit comments

Comments
 (0)