Skip to content

Commit

Permalink
Revert "Start cleanup process with setsid or nohup"
Browse files Browse the repository at this point in the history
This reverts commit c59a3c3.

The next commit will use Os.setsid() instead.
  • Loading branch information
rom1v committed Dec 9, 2024
1 parent 65256d7 commit 28b5bfb
Showing 1 changed file with 10 additions and 18 deletions.
28 changes: 10 additions & 18 deletions server/src/main/java/com/genymobile/scrcpy/CleanUp.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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<String> 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);
Expand Down

0 comments on commit 28b5bfb

Please sign in to comment.