• Bruce Dawson's avatar
    Prevent path-pollution from vpython3.bat · c4b1b772
    Bruce Dawson authored
    vpython3.bat adds an entry to the path. Unfortunately that modification
    persists after the batch file returns. Repeated running of vpython3.bat
    will eventually grow the path so long that the command to update the
    path exceeds the 8191 character cmd.exe command-length limit. This can
    most easily be seen by repeatedly running this command:
    
        vpython3 -c "print('Hello world!')" && set path | wc
    
    After about 35 invocations (dependent on exact system setup) this
    happens:
    
        >vpython3 -c "print('Hello world!')" && set path | wc
        The input line is too long.
        The syntax of the command is incorrect.
    
    This batch also (but less critically) leaks the PYTHON3_BIN_RELDIR
    environment variable.
    
    The fix is to add a setlocal command to keep environment changes local.
    
    Bug: 1003139
    Change-Id: I11a31e1013017da702299bfe8eb4888985c228f2
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3566378Reviewed-by: 's avatarAravind Vasudevan <aravindvasudev@google.com>
    Reviewed-by: 's avatarJosip Sokcevic <sokcevic@google.com>
    Reviewed-by: 's avatarBrian Ryner <bryner@google.com>
    Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
    c4b1b772
vpython3.bat 613 Bytes