diff options
author | Robby Russell <robby@planetargon.com> | 2013-12-01 13:53:24 -0800 |
---|---|---|
committer | Robby Russell <robby@planetargon.com> | 2013-12-01 13:53:24 -0800 |
commit | 270b1dc68991746d2a71ec9236104eaa59af827f (patch) | |
tree | 38363adf83e9360a35bb06e077ed13aa224af165 /plugins/mvn | |
parent | 1b337af75852a6e5842f29227ff52a6eea8f4b37 (diff) | |
parent | 96798c42f046fec7f01f53d10dd63f30ed6a1e07 (diff) | |
download | zsh-270b1dc68991746d2a71ec9236104eaa59af827f.tar.gz zsh-270b1dc68991746d2a71ec9236104eaa59af827f.tar.bz2 zsh-270b1dc68991746d2a71ec9236104eaa59af827f.zip |
Merge pull request #2242 from sztupy/fix-mvn-color-locale
Fix issues with special characters when running mvn
Diffstat (limited to 'plugins/mvn')
-rw-r--r-- | plugins/mvn/mvn.plugin.zsh | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/plugins/mvn/mvn.plugin.zsh b/plugins/mvn/mvn.plugin.zsh index 799f6fc8c..0c9141907 100644 --- a/plugins/mvn/mvn.plugin.zsh +++ b/plugins/mvn/mvn.plugin.zsh @@ -24,16 +24,18 @@ export RESET_FORMATTING=`tput sgr0` # Wrapper function for Maven's mvn command. mvn-color() { - # Filter mvn output using sed - mvn $@ | sed -e "s/\(\[INFO\]\ \-.*\)/${TEXT_BLUE}${BOLD}\1/g" \ - -e "s/\(\[INFO\]\ \[.*\)/${RESET_FORMATTING}${BOLD}\1${RESET_FORMATTING}/g" \ + ( + # Filter mvn output using sed. Before filtering set the locale to C, so invalid characters won't break some sed implementations + unset LANG + LC_CTYPE=C mvn $@ | sed -e "s/\(\[INFO\]\)\(.*\)/${TEXT_BLUE}${BOLD}\1${RESET_FORMATTING}\2/g" \ -e "s/\(\[INFO\]\ BUILD SUCCESSFUL\)/${BOLD}${TEXT_GREEN}\1${RESET_FORMATTING}/g" \ - -e "s/\(\[WARNING\].*\)/${BOLD}${TEXT_YELLOW}\1${RESET_FORMATTING}/g" \ - -e "s/\(\[ERROR\].*\)/${BOLD}${TEXT_RED}\1${RESET_FORMATTING}/g" \ + -e "s/\(\[WARNING\]\)\(.*\)/${BOLD}${TEXT_YELLOW}\1${RESET_FORMATTING}\2/g" \ + -e "s/\(\[ERROR\]\)\(.*\)/${BOLD}${TEXT_RED}\1${RESET_FORMATTING}\2/g" \ -e "s/Tests run: \([^,]*\), Failures: \([^,]*\), Errors: \([^,]*\), Skipped: \([^,]*\)/${BOLD}${TEXT_GREEN}Tests run: \1${RESET_FORMATTING}, Failures: ${BOLD}${TEXT_RED}\2${RESET_FORMATTING}, Errors: ${BOLD}${TEXT_RED}\3${RESET_FORMATTING}, Skipped: ${BOLD}${TEXT_YELLOW}\4${RESET_FORMATTING}/g" # Make sure formatting is reset echo -ne ${RESET_FORMATTING} + ) } # Override the mvn command with the colorized one. |