• Raul Tambre's avatar
    fetch: Decode gclient output if returning stdout · 43271f94
    Raul Tambre authored
    In Python 3 the output of a subprocess is bytes, so they need to be decoded to be used as a string.
    
    This previously caused the following error if there was an existing checkout during a fetch:
    Traceback (most recent call last):
      File "C:\Google\depot_tools\\fetch.py", line 318, in <module>
        sys.exit(main())
      File "C:\Google\depot_tools\\fetch.py", line 313, in main
        return run(options, spec, root)
      File "C:\Google\depot_tools\\fetch.py", line 299, in run
        if not options.force and checkout.exists():
      File "C:\Google\depot_tools\\fetch.py", line 98, in exists
        return (os.path.exists(os.path.join(gclient_root, b'.gclient')) or
      File "C:\Program Files\Python38\lib\ntpath.py", line 109, in join
        genericpath._check_arg_types('join', path, *paths)
      File "C:\Program Files\Python38\lib\genericpath.py", line 151, in _check_arg_types
        raise TypeError("Can't mix strings and bytes in path components") from None
    TypeError: Can't mix strings and bytes in path components
    
    Bug: 939847
    Change-Id: Ibf5b4923268595ba439586d688894f92696ecbb7
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1701403
    Auto-Submit: Raul Tambre <raul@tambre.ee>
    Reviewed-by: 's avatarDirk Pranke <dpranke@chromium.org>
    Commit-Queue: Raul Tambre <raul@tambre.ee>
    43271f94
fetch.py 10 KB