emscripten-core / emscripten-core/emscripten
emrun quits immediately
- Dominant language
- C++
- Stars
- 27.6k
- Forks
- 3.6k
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 109
Description
**Version of emscripten/emsdk:**
```text
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 6.0.6 (ce75e06884093bcefb86a6b8fd56a5d62a4cc245)
clang version 24.0.0git (https:/github.com/llvm/llvm-project ff6d537b14d737719d6377789784d04ff9565f65)
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: /usr/local/emsdk/upstream/bin
```
**Failing command line in full:**
```text
emrun --verbose --browser firefox index.html
```
**Full link command and output with `-v` appended:**
```
Web server root directory: /Volumes/Vault/deployment/build/emscripten-glfw/Debug
Starting web server: http://0.0.0.0:6931/
Starting browser: /Applications/Firefox.app/Contents/MacOS/firefox -url http://localhost:6931/index.html
/Applications/Firefox.app/Contents/MacOS/firefox
Searching for processes by full path name "/Applications/Firefox.app/Contents/MacOS/firefox".. found 1 entries
Before spawning web browser, found a running firefox browser process id: 917
Launched browser process with pid=12404
Now listening at http://0.0.0.0:6931/
Entering web server loop.
First navigation occurred. Identifying currently running browser processes
Searching for processes by full path name "/Applications/Firefox.app/Contents/MacOS/firefox".. found 2 entries
Detected running browser process id: 917, existed already at emrun startup? True
Detected running browser process id: 12404, existed already at emrun startup? False
Shutting down because browser is no longer alive
Browser process has shut down, quitting web server.
Web server loop done.
Closed web server.
emrun quitting with process exit code None
```
I am in the process of testing my changes to the latest version of emscripten-glfw (support for GLFW 3.5.1) and I run the exact same command I use to run: `emrun --verbose --browser firefox index.html`
Before, this was opening firefox and displaying `index.html` which is a static page that links to all the demos, then I could just click to every demo to see it. But now, it displays the page and quits as shown in the verbose output, stating "browser is no longer alive" which is absolutely not true (I did not quit the browser). If I start with `--no-browser` instead then it stays alive and doesn't quit.
I am not sure if this is the expected behavior, but it was not working that way before. Looking at the Changelog I am not seeing any obvious entry explaining this change (if it is an intentional change)
Contributor guide
Research direction
Start by reproducing `emrun --verbose --browser firefox index.html` and tracing the browser-process detection reported in the verbose output. Compare the behavior with `--no-browser`; done means Firefox remains open and emrun keeps its web server loop running while the browser is still alive.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- wasm
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100