Compare commits

..

3 Commits

Author SHA1 Message Date
86fffca4cd Log server pushed
Now that "adb push" stdout is disabled, add a log to notify server
pushed.
2021-11-20 00:21:46 +01:00
f5c60ee231 Use inherit flags for adb commands
Explicitly indicate, for each call, if stdout and stderr must be
inherited.
2021-11-20 00:21:46 +01:00
143bfc0395 Expose inherit flag for process execution
Let the caller decide if stdout and stderr must be inherited on process
creation, i.e. if stdout and stderr of the child process should be
printed in the scrcpy console.

This allows to get output and errors for specific adb commands depending
on the context.
2021-11-20 00:21:46 +01:00

View File

@ -90,11 +90,8 @@ sc_process_execute_p(const char *const argv[], HANDLE *handle, unsigned inherit,
HANDLE handles[3];
LPPROC_THREAD_ATTRIBUTE_LIST lpAttributeList = NULL;
// Must be set even if handle_count == 0, so that stdin, stdout and stderr
// are NOT inherited in that case
si.StartupInfo.dwFlags = STARTF_USESTDHANDLES;
if (handle_count) {
si.StartupInfo.dwFlags = STARTF_USESTDHANDLES;
unsigned i = 0;
if (pin) {
si.StartupInfo.hStdInput = stdin_read_handle;
@ -155,7 +152,9 @@ sc_process_execute_p(const char *const argv[], HANDLE *handle, unsigned inherit,
}
BOOL bInheritHandles = handle_count > 0;
DWORD dwCreationFlags = handle_count > 0 ? EXTENDED_STARTUPINFO_PRESENT : 0;
// DETACHED_PROCESS to disable stdin, stdout and stderr
DWORD dwCreationFlags = handle_count == 0 ? DETACHED_PROCESS
: EXTENDED_STARTUPINFO_PRESENT;
BOOL ok = CreateProcessW(NULL, wide, NULL, NULL, bInheritHandles,
dwCreationFlags, NULL, NULL, &si.StartupInfo, &pi);
free(wide);