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

Warn before quitting with sessions open #403

Closed
wants to merge 1 commit into from
Closed

Warn before quitting with sessions open #403

wants to merge 1 commit into from

Conversation

albinekb
Copy link
Contributor

@albinekb albinekb commented Jul 25, 2016

Fixes #399, #67

Im putting this up here to discuss if we should put an option in the menu like chrome
image

Or if we just should just have a config option for it in hyperterm.js

If we want to have it so that the checkbox changes your settings, we need to do like hpm to read and change hyperterm.js

However, with that approach there can be 🐎 race conditions, so i think we should wait with that.

@kjg
Copy link

kjg commented Jul 25, 2016

I'd rather have the application just save state and restore upon reopening instead, (and maybe make session restore the toggleable option)

@albinekb
Copy link
Contributor Author

@kjg What if you run commands that is long-running and don't want to accidentally terminate it?

Why not have both? 👼

@kjg
Copy link

kjg commented Jul 25, 2016

That's a good point. The way mac OS Terminal.app handles this is by showing a dialog warning about the currently running process ONLY when trying to quit or close the tab in which a process is running. I'd definitely like to see HyperTerm do the same. No preference needed for that, and no warning when there are no processes running.

@albinekb
Copy link
Contributor Author

That's really nice, great UX! I'll check and see what i can do 👼

@kjg
Copy link

kjg commented Jul 25, 2016

I can provide a screen shot or gif of the terminal.app behavior if that will help. Let me know, Thanks!

@albinekb
Copy link
Contributor Author

The problem is how to know if a session is currently running a process, anyone know how to? 👼

@rauchg
Copy link
Member

rauchg commented Jul 25, 2016

One way of doing so would be to ascertain that the current process title is different from the basename of the shell.

If the shell is /bin/bash and the current process title is ps then you're "running a process".

@kjg
Copy link

kjg commented Jul 26, 2016

There just has to be a better way than checking the title. If there are no hooks into if a process is running in a session, I think the best course of action is to add one and then take advantage of it.

@albinekb
Copy link
Contributor Author

@kjg yeah we got the pid to the process so i'm currently looking into how to use that

@rauchg
Copy link
Member

rauchg commented Jul 26, 2016

@kjg there also has to be a better way of obtaining the title than this hack I wrote:
https://github.com/zeit/hyperterm/blob/master/app/session.js#L79

@kjg
Copy link

kjg commented Jul 27, 2016

Ah yeah, there does seem like there should be a better way for getting the title than that haha. I couldn't figure it out quickly though.

@albinekb
Copy link
Contributor Author

I'm looking at https://github.com/Gottox/child_pty to see how hard it would be to make it come straight from there instead.

@timothyis timothyis added the 👩‍🔬 Status: In Progress Issue or PR is currently active and work is in progress label Jul 29, 2016
app.on('before-quit', (event) => {
const windows = BrowserWindow.getAllWindows().filter(win => win.sessions);

if (!quitIsConfirmed && Boolean(windows.length)) {
Copy link
Member

@TooTallNate TooTallNate Jul 29, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Boolean seems overly-clever here. Prefer windows.length > 0.

@albinekb
Copy link
Contributor Author

Closing this now, I will submit an updated version during #hacktoberfest 🎉

@albinekb albinekb closed this Sep 30, 2016
@jonaswindey
Copy link

any news on this?

@albinekb
Copy link
Contributor Author

Totally forgot this @jonaswindey 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
👩‍🔬 Status: In Progress Issue or PR is currently active and work is in progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants