Repository: lutris/lutris
Pull request: Kill Processes on Install Cancellation
Attempt to fix #2084

Problem statement:
Lutris doesn't completely kill Wine processes in the prefix after cancellation of the installation
It's not uncommon for me to get "creating prefix" messages just after cancellation of the game installation and see active processes that were launched during installation process in System Monitor (which are what triggering prefix re-creation after Lutris deletes it).
And same happens if the installation is not cancelled (which might caused issues with WINEESYNC option).
Perhaps Lutris should use `wineserver -k9` for this.

Hints from issue discussion:

Commit message: Updated install cancelation to kill wine processes

Patch to review:
diff --git a/lutris/gui/installerwindow.py b/lutris/gui/installerwindow.py
index e516e83f84..71610e3bd6 100644
--- a/lutris/gui/installerwindow.py
+++ b/lutris/gui/installerwindow.py
@@ -24,6 +24,7 @@
 from lutris.util.log import logger
 from lutris.util.strings import add_url_tags, escape_gtk_label
 
+from subprocess import Popen
 
 class InstallerWindow(BaseApplicationWindow):
     """GUI for the install process."""
@@ -481,6 +482,7 @@ def cancel_installation(self, widget=None):
             }
         )
         if confirm_cancel_dialog.result != Gtk.ResponseType.YES:
+            Popen(['wineserver', '-k9'], shell=True)
             return True
         if self.interpreter:
             self.interpreter.revert()


Code review comments:
diff_hunk: @@ -481,6 +482,7 @@ def cancel_installation(self, widget=None):
             }
         )
         if confirm_cancel_dialog.result != Gtk.ResponseType.YES:
+            Popen(['wineserver', '-k9'], shell=True)
path: lutris/gui/installerwindow.py
text: @user1:
don't use shell=True on subprocess calls