Start a new topic

Where to control PuTTY's exit behavior?

I think I've looked everywhere, but I can't seem to find an option in RoyalTS that controls the "Close window on exit: always/never/only on clean exit" behavior of PuTTY.

Despite this being mentioned a couple of times in threads about the whole "reconnect PuTTY sessions without losing scrollback", it seems to default to "only on clean exit".

Pair this with restrictive "security hardening" policies that enforce an idle timeout and work gets annoying fast. ;-)

(This is the CloseOnExit session property.)

Hi Christian,

can you show me the setting in PuTTY? Maybe a screenshot?


Hi Stefan, sure:


It should be easy to do since you're already generating a temporary session for each connection.
- CloseOnExit = 0 -> "never"
- CloseOnExit = 1 -> "only on clean exit" (the default, as far as I know)
- CloseOnExit = 2 -> "always"

Best regards

Thanks for that. I looked everywhere, just not on the first page ;)

Since PuTTY is embedded in Royal TS tabs/windows, I'm wondering if it would make sense to just set it always to "never". Or maybe set it depending on the


What do you think?

It depends, the RoyalTS reconnect dialog offers a few things that a disconnected-but-not-closed PuTTY window does not. It's not necessarily ideal to implicitly connect the two.

The reverse is true as well, and the reason for my question. A disconnected-but-not-closed PuTTY window can be reconnected using PuTTY's own reconnection feature, which maintains the scrollback. A much sought-after feature, if forum threads are any indicator. ;-)

Ideally, RoyalTS's own reconnect dialog would use (implicitly, or as an option) PuTTY's reconnect feature, but that has been discussed a bunch of times already. That dialog only comes up after the PuTTY window has already been destroyed, so you can't really have both at the same time.

Not to mention this would be specific to PuTTY, but the reconnect dialog is used by all plugins.

Finally, setting this to never also keeps the window open when actively, cleanly logging out.

PuTTY will show a non-warning "connection closed by remote host" popup.

That's also a bit annoying, but less so than losing scrollback.

Accordingly, this should probably not be the default.

Ultimately, whoever came up with the idea that shell sessions should auto-logout after 15 minutes should rethink their life. :-P

Hi Christian,

the next minor release will have the setting on the main page - similar to what PuTTY shows:

Neat, thank you!

You're welcome!

Thanks for providing this option. Although that still doesn't change that when using the "Reconnect" on the same tab, the previous scrollback is gone with the new windows. Is there a possibility to change that somehow, like putty does?

Hi Branko,

unfortunately this can't be done since PuTTY is an external process, we can't really tell what state the PuTTY session has. If you set the "Close on Exit" behavior to "Never", the PuTTY executable keeps running but in disconnected state. From Royal TS' point of view, PuTTY is still running and since we can't really tell if it's still connected or not, Royal TS assumes it is still connected. You actually need to tell PuTTY to restart the session in order to keep the scrollback buffer:

 I hope this helps.


1 person likes this

To save one step, you can even put that particular action into the quick action toolbar at the top left of the RoyalTS window:


1 person likes this

@Christian: that's a good point. Thanks for mentioning it!

Thank you both for fast replies, wasn't even aware there's a Menu for the actual Putty in RoyalTS to use directly. 

This usage makes sense, will use it instead of the RoyalTS reconnect to preserve the session.

Would it be possible to add the 'Restart Putty Session' in the right click context Menu of a Putty tab? I reconnect or make duplicates of a connection a lot with right-clicking on a open tab, so restarting the session would be faster this way.

That's currently not possible as the context menu is not aware of the underlying connection type. This is rather hard to implement right now and I can't tell if and how we can support scenarios like this. I suggest you put the command in the quick access toolbar for easier access if you really need the command that often.


Login or Signup to post a comment