Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

avoid printing on stderr if linter successful #88

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions scripts/test_wrapper
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
#!/bin/bash

set -o pipefail

RESULTS_FILE=$1
TARGET_NAME=${@: -1}
shift

# Run remain args as test command, capturing the output.
LINTER_OUTPUT=$( $@ 2>&1 | tee /dev/stderr )
LINTER_OUTPUT="$( $@ 2>&1 )"
LINTER_RESULT=$?

mkdir -p `dirname $RESULTS_FILE`
if [[ "$LINTER_RESULT" == "0" ]]; then
# Lint pass
echo "$LINTER_OUTPUT"
cat <<ENDXML > $RESULTS_FILE
<?xml version="1.0" encoding="UTF-8"?>
<testsuite name="roslint" tests="1" failures="0" errors="0">
Expand All @@ -22,8 +21,9 @@ ENDXML
exit 0
else
# Lint failed
# TODO: This output could be more helpful; really just a first cut.
cat <<ENDXML > $RESULTS_FILE
echo "$LINTER_OUTPUT" >&2
# TODO: This output could be more helpful; really just a first cut.
cat <<ENDXML > $RESULTS_FILE
<?xml version="1.0" encoding="UTF-8"?>
<testsuite name="roslint" tests="1" failures="1" errors="0">
<testcase name="$TARGET_NAME" classname="roslint.LintCheck">
Expand Down