Start cleanup process with setsid()
Reimplement c59a3c3169973abb4ce236e06990d58ae6567481 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:
parent
28b5bfb90e
commit
a9aadc95df
@ -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]);
|
||||
|
Loading…
x
Reference in New Issue
Block a user