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

main function in @main types fails with error #4835

Open
MaxDesiatov opened this issue Aug 28, 2022 · 3 comments
Open

main function in @main types fails with error #4835

MaxDesiatov opened this issue Aug 28, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@MaxDesiatov
Copy link

MaxDesiatov commented Aug 28, 2022

Describe the bug
This sample code fails immediately after it starts executing:

import JavaScriptEventLoop

@main
enum Main {
  static func main() async throws {
    JavaScriptEventLoop.installGlobalExecutor()
  }
}

Screenshots
Screenshot 2022-08-28 at 21 44 22

Environment
SwiftWasm 5.6.0, carton 0.16.1

@MaxDesiatov MaxDesiatov added the bug Something isn't working label Aug 28, 2022
@MaxDesiatov MaxDesiatov changed the title Async @main code fails with error main function in @main types fails with error Aug 28, 2022
@kateinoigakukun
Copy link
Member

It's expected behavior because async_Main calls exit(0) at the end of the initial job.

@MaxDesiatov
Copy link
Author

My concern here is that uncaught JS error may lead to some unexpected/incorrect state, or at least confuse users. Maybe we should detect this specific exit(0) in our entrypoint code to make sure it's handled appropriately?

@kateinoigakukun
Copy link
Member

@MaxDesiatov Yes, that should be handled by instance startup JS code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: To triage
Development

No branches or pull requests

2 participants