Skip to content

Conversation

@sbc100
Copy link
Collaborator

@sbc100 sbc100 commented May 26, 2021

Using addAtMain stopped working for programs without main functions
(HAS_MAIN not defined) after #13901.

Code that needs to populate the FS is mostly likely going to be run
during preRun callback which all happen before ATINITs.

Copy link
Member

@kripken kripken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than that comment, I think this looks good.

It may be good to document that permissions are ignored during preRun, but not after. Perhaps this:

diff --git a/src/library_fs.js b/src/library_fs.js
index 62aedb89e..91e20c6f8 100644
--- a/src/library_fs.js
+++ b/src/library_fs.js
@@ -97,8 +97,9 @@ FS.staticInit();` +
     initialized: false,
     // Whether we are currently ignoring permissions. Useful when preparing the
     // filesystem and creating files inside read-only folders.
-    // This is set to false when the runtime is initialized, allowing you
-    // to modify the filesystem freely before run() is called.
+    // This is set to false during the "Init" phase, which means that you can
+    // modify the filesystem freely during "PreRun" using Module.preRun for
+    // example.
     ignorePermissions: true,
     trackingDelegate: {},
     tracking: {

Using addAtMain stopped working for programs without main functions
(HAS_MAIN not defined) after #13901.

Code that needs to populate the FS is mostly likely going to be run
during preRun callback which all happen before ATINITs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants