mirror of
https://github.com/Genymobile/scrcpy
synced 2025-08-31 06:15:25 +00:00
Start cleanup process with setsid()
Reimplement c59a3c3169
using Os.setsid().
Refs #5613 comment <https://github.com/Genymobile/scrcpy/pull/5613#issuecomment-2527045669>
Suggested-by: Simon Chan <1330321+yume-chan@users.noreply.github.com>
This commit is contained in:
@@ -6,6 +6,8 @@ import com.genymobile.scrcpy.util.Settings;
|
||||
import com.genymobile.scrcpy.util.SettingsException;
|
||||
|
||||
import android.os.BatteryManager;
|
||||
import android.system.ErrnoException;
|
||||
import android.system.Os;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@@ -163,6 +165,12 @@ public final class CleanUp {
|
||||
}
|
||||
|
||||
public static void main(String... args) {
|
||||
try {
|
||||
// Start a new session to avoid being terminated along with the server process on some devices
|
||||
Os.setsid();
|
||||
} catch (ErrnoException e) {
|
||||
Ln.e("setsid() failed", e);
|
||||
}
|
||||
unlinkSelf();
|
||||
|
||||
int displayId = Integer.parseInt(args[0]);
|
||||
|
Reference in New Issue
Block a user