mirror of
https://github.com/Genymobile/scrcpy.git
synced 2025-07-30 12:48:59 +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:
parent
28b5bfb90e
commit
a9aadc95df
1 changed files with 8 additions and 0 deletions
|
@ -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]);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue