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

Apparently Window Closes when I edit Main Electron File #2

Open
deadcoder0904 opened this issue Feb 4, 2018 · 8 comments
Open

Apparently Window Closes when I edit Main Electron File #2

deadcoder0904 opened this issue Feb 4, 2018 · 8 comments
Labels
bug Something isn't working 💵 Funded on Issuehunt This issue has been funded on Issuehunt help wanted Extra attention is needed

Comments

@deadcoder0904
Copy link

deadcoder0904 commented Feb 4, 2018

Issuehunt badges

I just added console.log('its not working') to index.js & app stopped. index.html works.

There is a $40.00 open bounty on this issue. Add more on Issuehunt.

@sindresorhus
Copy link
Owner

From the top of the readme:

When files used in the main process are changed, the app is restarted, and when files used in the browser window are changed, the page is reloaded.

@deadcoder0904
Copy link
Author

deadcoder0904 commented Feb 5, 2018

Ohh so this is just a replacement for Refresh❓

When files used in the main process are changed, the app is restarted, and when files used in the browser window are changed, the page is reloaded.

I still don't understand this bcz my terminal stops but the app is still running & AFAIK when terminal stops app also closes when this package is not used.

@1nv1n
Copy link

1nv1n commented Oct 3, 2018

Hey @sindresorhus, first off; thanks for the package! Adding my comment/question here since it's somewhat related to the issue opened.
I just initialized a new app using electron-forge & added electron-reloader.

I've included require('electron-reloader')(module); in a try-catch & if I make a change on main.js, the app restarts - but I end up with two windows. Make another change & now I have 3 windows.

It wasn't completely clear from the README whether this is expected (I would expect not), but wanted to check with you.

Thanks!

@Lokua
Copy link

Lokua commented Jan 3, 2019

I was also a bit confused as even though editing main.js does restart the app, it also exits the original process so you're left without terminal. I tried to patch around the source code but didn't get far, so decided to add my main process files to electron-reloader ignore option, and am using the following script to start the app. Perhaps others coming across this will find it helpful (you'll probably want to adjust the args to spawn to reflect your needs):

https://gist.github.com/Lokua/b88ffc4aa32398abe3cf8688444799ac

@sindresorhus sindresorhus added bug Something isn't working help wanted Extra attention is needed labels Mar 16, 2019
@IssueHuntBot
Copy link

@IssueHunt has funded $40.00 to this issue.


@catdad
Copy link

catdad commented Mar 21, 2019

This issue is inherent to how Electron works (at least on Windows). When an electron app is launched, it will create a new process group, separate from the command line process. When you app.relaunch(), it will in fact launch a second instance of the app when the first one exits. Anything running in-process inside the electron app won't have any control over the reuse of stdio, which is why this and all the other in-process live reloaders have this issue. Without digging into the electron source code itself to figure out if electron can be changed to allow for better restarts, the best way I have found to deal with this issue is using an out-of-process manager like electronmon.

@issuehunt-oss issuehunt-oss bot added the 💵 Funded on Issuehunt This issue has been funded on Issuehunt label May 10, 2019
@j0hnm4r5
Copy link

j0hnm4r5 commented Dec 4, 2019

On MacOS, I'm hitting pretty much the same issue; on reload the terminal process exits and the app closes, then the app reopens (but the terminal process does not reconnect, leaving me with no console logs).

@MegaJSDeveloper
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working 💵 Funded on Issuehunt This issue has been funded on Issuehunt help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

8 participants