73c3c787abbe1ca71b900f11bb880e1de09c6d2a,src/python/pants/engine/process.py,,find_binary,#Any#,376

Before Change


        CreateDigest([FileContent(script_path, script_content.encode(), is_executable=True)]),
    )

    paths = []
    search_path = create_path_env_var(request.search_path)
    result = await Get(
        FallibleProcessResult,
        // We use a volatile process to force re-run since any binary found on the host system today
        // could be gone tomorrow. Ideally we"d only do this for local processes since all known
        // remoting configurations include a static container image as part of their cache key which
        // automatically avoids this problem.
        UncacheableProcess(
            Process(
                description=f"Searching for `{request.binary_name}` on PATH={search_path}",
                level=LogLevel.DEBUG,
                input_digest=script_digest,
                argv=[script_path, request.binary_name],
                env={"PATH": search_path},
            )
        ),
    )
    if result.exit_code == 0:
        paths.extend(result.stdout.decode().splitlines())

    return BinaryPaths(binary_name=request.binary_name, paths=paths)

After Change


    if result.exit_code != 0:
        return binary_paths

    found_paths = result.stdout.decode().splitlines()
    if not request.test_args:
        return dataclasses.replace(binary_paths, paths=[BinaryPath(path) for path in found_paths])

    results = await MultiGet(
        Get(
            FallibleProcessResult,
            UncacheableProcess(
                Process(argv=[path, *request.test_args], description=f"Test binary {path}.")
            ),
        )
        for path in found_paths
    )
    return dataclasses.replace(
        binary_paths,
        paths=[
            BinaryPath.fingerprinted(path, result.stdout)
            for path, result in zip(found_paths, results)
            if result.exit_code == 0
        ],
    )

Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 7

Instances


Project Name: pantsbuild/pants
Commit Name: 73c3c787abbe1ca71b900f11bb880e1de09c6d2a
Time: 2020-09-13
Author: john.sirois@gmail.com
File Name: src/python/pants/engine/process.py
Class Name:
Method Name: find_binary


Project Name: explosion/thinc
Commit Name: d6d7cb7db51776b026514a1a2caa4073b9e998ad
Time: 2020-01-19
Author: honnibal+gh@gmail.com
File Name: thinc/backends/ops.py
Class Name: Ops
Method Name: pad


Project Name: hellohaptik/chatbot_ner
Commit Name: 34f14dac8d65ffd6210a87a610afad1593d47294
Time: 2019-06-18
Author: jain.chirag925@gmail.com
File Name: ner_v1/detectors/numeral/budget/budget_detection.py
Class Name: BudgetDetector
Method Name: __init__