mirror of
https://github.com/Genymobile/scrcpy.git
synced 2025-04-21 12:05:00 +00:00
Fix adb server hang
Since commit 0426708544
, the server is run
in a dedicated thread. For SDL, many signals, including SIGINT and
SIGTERM, are masked for new threads. As a result, if the adb server is
not already running, adb commands invoked by scrcpy will start an adb
server that ignores those signals and cannot be terminated at system
shutdown.
This commit is contained in:
parent
5704ec6967
commit
836275f47a
1 changed files with 7 additions and 0 deletions
|
@ -119,6 +119,13 @@ sc_process_execute_p(const char *const argv[], sc_pid *pid, unsigned flags,
|
|||
|
||||
close(internal[0]);
|
||||
enum sc_process_result err;
|
||||
|
||||
// Somehow SDL masks many signals - undo them for other processes
|
||||
// https://github.com/libsdl-org/SDL/blob/release-2.0.18/src/thread/pthread/SDL_systhread.c#L167
|
||||
sigset_t mask;
|
||||
sigemptyset(&mask);
|
||||
sigprocmask(SIG_SETMASK, &mask, NULL);
|
||||
|
||||
if (fcntl(internal[1], F_SETFD, FD_CLOEXEC) == 0) {
|
||||
execvp(argv[0], (char *const *) argv);
|
||||
perror("exec");
|
||||
|
|
Loading…
Add table
Reference in a new issue