Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always os.chdir("/") when reloading #9224

Merged
merged 1 commit into from
May 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -473,9 +473,6 @@ STATIC bool __attribute__((noinline)) run_code_py(safe_mode_t safe_mode, bool *s
usb_setup_with_vm();
#endif

// Make sure we are in the root directory before looking at files.
common_hal_os_chdir("/");

// Check if a different run file has been allocated
if (next_code_configuration != NULL) {
next_code_configuration->options &= ~SUPERVISOR_NEXT_CODE_OPT_NEWLY_SET;
Expand Down Expand Up @@ -1112,6 +1109,10 @@ int __attribute__((used)) main(void) {
serial_write_compressed(MP_ERROR_TEXT("soft reboot\n"));
}
simulate_reset = false;

// Always return to root before trying to run files.
common_hal_os_chdir("/");

if (pyexec_mode_kind == PYEXEC_MODE_FRIENDLY_REPL) {
// If code.py did a fake deep sleep, pretend that we
// are running code.py for the first time after a hard
Expand Down