mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-02 19:39:49 +09:00
Merge pull request #5040 from d3lm/delm/feat/wasi/set-current-dir
Add ability to initialize cwd from PWD when targeting WASI
This commit is contained in:
@@ -63,6 +63,14 @@ pub use settings::{opts_with_clap, RunMode};
|
||||
pub fn run(init: impl FnOnce(&mut VirtualMachine) + 'static) -> ExitCode {
|
||||
env_logger::init();
|
||||
|
||||
// NOTE: This is not a WASI convention. But it will be convenient since POSIX shell always defines it.
|
||||
#[cfg(target_os = "wasi")]
|
||||
{
|
||||
if let Ok(pwd) = env::var("PWD") {
|
||||
let _ = env::set_current_dir(pwd);
|
||||
};
|
||||
}
|
||||
|
||||
let (settings, run_mode) = opts_with_clap();
|
||||
|
||||
// Be quiet if "quiet" arg is set OR stdin is not connected to a terminal
|
||||
|
||||
Reference in New Issue
Block a user