Dup the correct fd for qemu pipe.

Logcat dup-es STDOUT and used the dup-ed file descriptor to write logging
information. Because of this writes happen on that fd and not on stdout.
This in turn causes no output in the LogcatService in the emulator.

The qemu-pipe forwarder now dup-es the same fd as logcat is using so
that we receive data again.

Bug: b/145214141
Test: Logcat works again in emulator 29.2.10
Change-Id: Ia6e2430f1d7a0476a5b438d315a9ea337c13806d
This commit is contained in:
Erwin Jansen 2019-11-27 12:58:58 -08:00
parent 4ac630b562
commit 4f138b2ce8
1 changed files with 1 additions and 1 deletions

View File

@ -865,7 +865,7 @@ int Logcat::Run(int argc, char** argv) {
}
}
// close output and error channels, replace with console
dup2(fd, STDOUT_FILENO);
dup2(fd, output_fd_.get());
dup2(fd, STDERR_FILENO);
close(fd);
}