Eel
Eel copied to clipboard
Fixes to getting Electron to work
This PR includes 3 fixes. The first one is for #371 which I ended up forking/fixing, the other two were done in an attempt to get my app to run in electron for those that do not have chrome available. I wanted to include electron in my app, and found all sorts of issues, which this finally fixes.
The first issue I found is that setting the mode to "electron" on windows will cause an exception because if which
returns None, you try a os.path.join(None, "../node_modules/etc...")
which will fail.
The second issue is that I realized that no matter what I did, it wouldn't work because the run command adds "." as an argument, and while removing it fixed it, I believe you had that in there on purpose because it specifies the current working directory for an electron bundle, and I didn't want to change that as it would break for those using a different system than what I'm doing.
Basically, I just downloaded the electron binaries from their releases, extracted it under a subdir, added it to the PATH, and I want to run it directly from there. There is no bat file, and no node_modules here, and launching electron with "." as its first argument will fail because my app's current dir is not an electron bundle. Using "custom" mode was the only solution, but that launches cmdline_args
but without adding the url to it, and since I use port=0
I had no way of hardcoding the url in the cmdline_args
option either (and doing a block=false, and then trying to get the port to launch manually, and losing that whole websocket auto close thing, etc.. felt way too complicated than just adding a callback for custom
modes).
So that's the explanation around where these commits are coming from, hopefully this gets accepted. Thanks!