From 263594634731f6ba0abf4affa085ef404aee741e Mon Sep 17 00:00:00 2001 From: Krystian <66848411+krystianll@users.noreply.github.com> Date: Sat, 13 Jun 2020 22:05:04 +0200 Subject: [PATCH] Update server.R I propose the addition of stopApp(). It will ensure that whenever user closes the window when running the session locally, the shiny app and the server will be terminated. It is most visible when running from R Console or from Terminal using Rscript, which are still busy even after user closes the browser tab. I should probably add that this shouldn't be added to a publicly accessible, server-deployed app since closing the window will kill the whole app for every on-line user. --- server.R | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server.R b/server.R index 8138722..564df32 100644 --- a/server.R +++ b/server.R @@ -409,6 +409,10 @@ shinyServer(function(input, output, session) { content = function(file) { write.csv(dataM(), file, row.names=FALSE) }) ### + + session$onSessionEnded(function() { + stopApp() + }) })