From 28b5bfb90e76f059571a88931b86eb86f6ca8dd7 Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Mon, 9 Dec 2024 09:29:29 +0100 Subject: [PATCH] Revert "Start cleanup process with setsid or nohup" This reverts commit c59a3c3169973abb4ce236e06990d58ae6567481. The next commit will use Os.setsid() instead. --- .../java/com/genymobile/scrcpy/CleanUp.java | 28 +++++++------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/server/src/main/java/com/genymobile/scrcpy/CleanUp.java b/server/src/main/java/com/genymobile/scrcpy/CleanUp.java index ac265229d4..f372855bf2 100644 --- a/server/src/main/java/com/genymobile/scrcpy/CleanUp.java +++ b/server/src/main/java/com/genymobile/scrcpy/CleanUp.java @@ -10,8 +10,6 @@ import java.io.File; import java.io.IOException; import java.io.OutputStream; -import java.util.ArrayList; -import java.util.List; /** * Handle the cleanup of scrcpy, even if the main process is killed. @@ -109,22 +107,16 @@ private void runCleanUp(Options options) { private void run(int displayId, int restoreStayOn, boolean disableShowTouches, boolean powerOffScreen, int restoreScreenOffTimeout) throws IOException { - - List cmd = new ArrayList<>(); - if (new File("/system/bin/setsid").exists()) { - cmd.add("/system/bin/setsid"); - } else if (new File("/system/bin/nohup").exists()) { - cmd.add("/system/bin/nohup"); - } - - cmd.add("app_process"); - cmd.add("/"); - cmd.add(CleanUp.class.getName()); - cmd.add(String.valueOf(displayId)); - cmd.add(String.valueOf(restoreStayOn)); - cmd.add(String.valueOf(disableShowTouches)); - cmd.add(String.valueOf(powerOffScreen)); - cmd.add(String.valueOf(restoreScreenOffTimeout)); + String[] cmd = { + "app_process", + "/", + CleanUp.class.getName(), + String.valueOf(displayId), + String.valueOf(restoreStayOn), + String.valueOf(disableShowTouches), + String.valueOf(powerOffScreen), + String.valueOf(restoreScreenOffTimeout), + }; ProcessBuilder builder = new ProcessBuilder(cmd); builder.environment().put("CLASSPATH", Server.SERVER_PATH);