• Stephen McGruer's avatar
    [chromedriver] Support --enable-chrome-logs on Windows · e670936f
    Stephen McGruer authored
    On Windows, handlers are not inherited by default (unlike unix). This
    includes stdout and stderr, so by default a process launched via
    CreateProcess does not send output to the same place as its parent. When
    running ChromeDriver manually in a terminal this is fine, since all the
    output ends up in the terminal anyway, but if ChromeDriver is launched
    programmatically then the root process cannot see the output from the
    browser:
    
    my_runner.exe --> chromedriver.exe --> chrome.exe
    
    In the above example, without inherited handles my_runner.exe does not
    see chrome.exe's output.
    
    The solution is to set the stdout and stderr handles to be the same ones
    that ChromeDriver is using, and make them explicitly inherited.
    
    Bug: 1109233
    Change-Id: Iac18beed5583ea7b7830015d765f3670c86b652b
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2335355
    Commit-Queue: Stephen McGruer <smcgruer@chromium.org>
    Reviewed-by: default avatarJohn Chen <johnchen@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#798379}
    e670936f
chrome_launcher.cc 46.2 KB