From 9c823145704d09c94d7fff00ea3c7cb0606ff951 Mon Sep 17 00:00:00 2001 From: Yamashita Yuu Date: Thu, 23 Jan 2014 11:09:23 +0900 Subject: [PATCH] Unset `GREP_OPTIONS` to avoid unexpected grep behavior (fixes #101) --- libexec/pyenv | 2 ++ test/libexec/pyenv-grep | 2 ++ test/pyenv.bats | 8 ++++++++ 3 files changed, 12 insertions(+) create mode 100755 test/libexec/pyenv-grep diff --git a/libexec/pyenv b/libexec/pyenv index 05955aa7..e294f638 100755 --- a/libexec/pyenv +++ b/libexec/pyenv @@ -18,6 +18,8 @@ if [ -z "$READLINK" ]; then exit 1 fi +unset GREP_OPTIONS + resolve_link() { $READLINK "$1" } diff --git a/test/libexec/pyenv-grep b/test/libexec/pyenv-grep new file mode 100755 index 00000000..862c66fc --- /dev/null +++ b/test/libexec/pyenv-grep @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +grep -E "$@" diff --git a/test/pyenv.bats b/test/pyenv.bats index 2b33d9fc..759794ee 100644 --- a/test/pyenv.bats +++ b/test/pyenv.bats @@ -45,3 +45,11 @@ load test_helper assert_failure assert_output "pyenv: cannot change working directory to \`$dir'" } + +@test "conflicting GREP_OPTIONS" { + file="${BATS_TMPDIR}/hello" + echo "hello" > "$file" + GREP_OPTIONS="-F" run pyenv grep "hell." "$file" + assert_success + assert_output "hello" +}