mirror of
https://github.com/Genymobile/scrcpy.git
synced 2025-12-17 05:24:19 +01: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 com.genymobile.scrcpy.util.SettingsException;
|
||||||
|
|
||||||
import android.os.BatteryManager;
|
import android.os.BatteryManager;
|
||||||
|
import android.system.ErrnoException;
|
||||||
|
import android.system.Os;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -163,6 +165,12 @@ public final class CleanUp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String... args) {
|
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();
|
unlinkSelf();
|
||||||
|
|
||||||
int displayId = Integer.parseInt(args[0]);
|
int displayId = Integer.parseInt(args[0]);
|
||||||
|
|||||||
Reference in New Issue
Block a user