[Scons-users] TypeError writing to stderror in MSCommon/Common.py [reformatted]

Joseph C. Brill jbrill at mindspring.com
Wed Dec 4 16:53:13 EST 2019


The following approach seems reasonable to suppress the powershell.exe
invocations in vsdevcmd.bat (VS 2019 16.4) when powershell.exe is not on the
path in function get_output of common.py (comments removed and whitespace
added):

    vscmd_skip_telemetry = 'VSCMD_SKIP_SENDTELEMETRY'

    vs_vc_vars = [
        'COMSPEC',
        vscmd_skip_telemetry,
        'VS140COMNTOOLS',
        'VS120COMNTOOLS',
        'VS110COMNTOOLS',
        'VS100COMNTOOLS',
        'VS90COMNTOOLS',
        'VS80COMNTOOLS',
        'VS71COMNTOOLS',
        'VS70COMNTOOLS',
        'VS60COMNTOOLS',
    ]

    env['ENV'] = normalize_env(env['ENV'], vs_vc_vars, force=False)

    if vscmd_skip_telemetry not in env['ENV']:
        if not env.WhereIs('powershell.exe'):
            env['ENV'][vscmd_skip_telemetry] = '1'

The telemetry environment variable is added to the list passed to normalize
the environment.

If the user did not define the telemetry environment variable, check to see
if powershell.exe is on the path.

If powershell.exe is not on the path and the user did not define the
telemetry variable, add the variable to the environment to suppress
vsdevcmd.bat from invoking powershell.

If a user really wants telemetry, the user is responsible for getting
powershell.exe on the system path which would not automatically add the
telemetry variable to the environment.



More information about the Scons-users mailing list