Skip to content

Commit

Permalink
Redirect bootstrapping calls in pants binary to stderr (pantsbuild#4131)
Browse files Browse the repository at this point in the history
### Problem
CI fails intermittently in the pre-commit checks while attempting to run `isort.sh`. My hypothesis is that it is because the bootstrap and activation parts of the pants script are echoing things to stdout. `isort.sh` runs `./pants changed` and tees the results into a file, assuming that only target specs will be added to the file. If bootstrap were to write to stdout, it would cause problems when the specs were passed to the fmt.isort call.

### Solution
This patch redirects the activation and bootstrap calls' stdout to stderr which ensures they will not interfere even if they have writes to stdout.
  • Loading branch information
baroquebobcat authored and lenucksi committed Apr 22, 2017
1 parent de2b5fc commit bd798f4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pants
Expand Up @@ -61,8 +61,9 @@ fi
PANTS_SRCPATH="$(echo ${PANTS_SRCPATH[@]} | tr ' ' :)"

function exec_pants_bare() {
activate_pants_venv
bootstrap_native_code
# Redirect activation and native bootstrap to ensure that they don't interfere with stdout.
activate_pants_venv 1>&2
bootstrap_native_code 1>&2
PYTHONPATH="${PANTS_SRCPATH}:${PYTHONPATH}" \
exec python ${PANTS_EXE} "$@"
}
Expand Down

0 comments on commit bd798f4

Please sign in to comment.