Giter Club home page Giter Club logo

Comments (15)

vzqzac avatar vzqzac commented on June 6, 2024 1

Sorry for talking about something not related, but this might be a good time to add an issue template with steps to reproduce and context to approach problems better.

from electron-with-express.

frankhale avatar frankhale commented on June 6, 2024 1

Yep thank you so much @vzqzac for the pull request. I've merged it.

from electron-with-express.

frankhale avatar frankhale commented on June 6, 2024

The thing is, is that the BrowserWindow is a different process than the server so while the window will close it won't automatically close the server. Have a look at this issue: #11 as this method was adopted. Before you close the browser window send an IPC message 'stop-server' so that the server will close.

That said, this method is a stop gap measure, we can do better than this and we really should. If you play around with the code and find a better way to do it please send a pull request.

from electron-with-express.

joelsurgithub avatar joelsurgithub commented on June 6, 2024

yes okay but there is already an event

on("close", ...)

with

mainWindow.webContents.send('stop-server');

in main.js.
Then why when I do windoww.close(); does the server not close?

from electron-with-express.

frankhale avatar frankhale commented on June 6, 2024

Then why when I do windoww.close(); does the server not close?

All I can say is that the event may not be firing, or the IPC message isn't working so the server isn't being closed. It used to work. When I get some time I'll take a look.

from electron-with-express.

frankhale avatar frankhale commented on June 6, 2024

What platform are you on? I have been looking at this today and I cannot reproduce the issue on Windows 10.

from electron-with-express.

frankhale avatar frankhale commented on June 6, 2024

I'm running from command line using npm start and then I close the Electron window and the processes are all closing as expected. They are all closing even without the extra bit of code to tell the server to quit. So I think Windows is taking care of it but this may be an issue on Linux or Mac but I'm not sure.

from electron-with-express.

frankhale avatar frankhale commented on June 6, 2024

are you on a platform other than Windows?

from electron-with-express.

joelsurgithub avatar joelsurgithub commented on June 6, 2024

Sorry I don't think to check my emails... Yes, I'm on Linux. But the server does not close only when I close the application with win.close()

from electron-with-express.

frankhale avatar frankhale commented on June 6, 2024

It could be that the Window close event that is standard bypasses the Electron BrowserWindow close event. That's interesting and I'd think it'd be a bug in Electron if that were the case. I'll have to try on a Linux VM to see how it behaves. Give me some time because I just started a new job this morning.

from electron-with-express.

frankhale avatar frankhale commented on June 6, 2024

Totally agree @vzqzac !!!! If you have some ideas for this template please let me know and I'll gladly incorporate those ideas into it =)

Thank you for the suggestion!!!

from electron-with-express.

frankhale avatar frankhale commented on June 6, 2024

@vzqzac I don't even know how to create a issue template. Is this something that is added to the code repo and then is used by the issue tracker? Can you show me how to do it or point me to a reference on how to do it?

from electron-with-express.

vzqzac avatar vzqzac commented on June 6, 2024

Thanks for your response @frankhale, I just opened #16 with what I think is the proper information to add the templates, I'd appreciate your review there and of course any change request is highly appreciated too!

from electron-with-express.

frankhale avatar frankhale commented on June 6, 2024

So as I rewrite this I am finding that this is a really big problem. Sometimes the processes will exit and other times they won't. This is super annoying. I wonder if it's any better on Linux or Mac. Windows is a serious pain in the @$$!

from electron-with-express.

frankhale avatar frankhale commented on June 6, 2024

Closing this in favor of tracking this in #21

from electron-with-express.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.