提交 4eb7c6c3 作者: Jeromy Johnson 提交者: GitHub

Merge pull request #3085 from ipfs/fix-test_fsh

ipfs-test-lib: fix test_fsh arg quoting
# Generic test functions for go-ipfs
# Quote arguments for sh eval
shellquote() {
_space=''
for _arg
do
# On Mac OS, sed adds a newline character.
# With a printf wrapper the extra newline is removed.
printf "$_space'%s'" "$(printf "%s" "$_arg" | sed -e "s/'/'\\\\''/g;")"
_space=' '
done
printf '\n'
}
# Echo the args, run the cmd, and then also fail,
# making sure a test case fails.
test_fsh() {
echo "> $@"
eval "$@"
eval $(shellquote "$@")
echo ""
false
}
......@@ -31,19 +44,6 @@ test_path_cmp() {
test_cmp "$1_std" "$2_std"
}
# Quote arguments for sh eval
shellquote() {
_space=''
for _arg
do
# On Mac OS, sed adds a newline character.
# With a printf wrapper the extra newline is removed.
printf "$_space'%s'" "$(printf "%s" "$_arg" | sed -e "s/'/'\\\\''/g;")"
_space=' '
done
printf '\n'
}
# Docker
# This takes a Dockerfile, and a build context directory
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论