Skip to content

Commit

Permalink
Fixes when ran by "bash shellcpec" and "ksh shellspec"
Browse files Browse the repository at this point in the history
  • Loading branch information
ko1nksm committed May 26, 2020
1 parent 674906e commit 768f5f5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion shellspec
Expand Up @@ -105,7 +105,11 @@ readlinkf() {
done 2>/dev/null; cd "$2" && OLDPWD=$3 && [ ${5+x} ] && printf '%s\n' "$5"
}

if ! SHELLSPEC_PATH=$(readlinkf "$0"); then
self=$0
[ "${BASH_SOURCE:-}" ] && eval "self=\${BASH_SOURCE[0]}"
( eval "[ \"\${.sh.file:-}\" ]" ) 2>/dev/null && eval "self=\${.sh.file}"

if ! SHELLSPEC_PATH=$(readlinkf "$self"); then
echo "Failed to detect shellspec real path." >&2
exit 1
fi
Expand Down
2 changes: 1 addition & 1 deletion spec/libexec/shellspec_spec.sh
Expand Up @@ -164,7 +164,7 @@ Describe "libexec/shellspec.sh"
End

Context "when ps command not found"
Before PATH=''
ps() { exit 127; }
It "returns nothing"
When call read_ps 111
The status should be success
Expand Down

0 comments on commit 768f5f5

Please sign in to comment.