summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rts/RtsStartup.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/rts/RtsStartup.c b/rts/RtsStartup.c
index 46749163dc..9495eb3b43 100644
--- a/rts/RtsStartup.c
+++ b/rts/RtsStartup.c
@@ -252,6 +252,17 @@ hs_init_ghc(int *argc, char **argv[], RtsConfig rts_config)
stg_exit(1);
}
+#if defined(wasm32_HOST_ARCH)
+ char *pwd = getenv("PWD");
+ if (pwd != NULL) {
+ int chdir_result = chdir(pwd);
+ if (chdir_result != 0) {
+ errorBelch("hs_init_ghc: chdir(%s) failed with %d", pwd, chdir_result);
+ stg_exit(1);
+ }
+ }
+#endif
+
setlocale(LC_CTYPE,"");
/* Initialise the stats department, phase 0 */