[英]SVN post-commit hook isn't executing a command properly
I have a post-commit hook that works, but for some reason the following line of code is not working properly. 我有一个提交后的钩子可以工作,但是由于某种原因,以下代码行无法正常工作。 It creates my test file regardless of a fail.
无论失败,它都会创建我的测试文件。
!#/bin/sh
# force a failure
ifconfig -z 1>/dev/null 2>&1
if [ $? -ne 0 ]
then
touch ~/Desktop/fail.txt
fi
The fail.txt file is created with or without that -z
. 创建带有或不带有
-z
的fail.txt文件。 However, if I run this same code without executing via my post-commit hook, it works as it should. 但是,如果我运行相同的代码而不通过提交后的钩子执行,则它应能正常工作。
Any suggestions? 有什么建议么?
Hook scripts execute in an empty environment, including an empty or severely limited PATH
. 挂钩脚本在空的环境中执行,包括空的或严格限制的
PATH
。 As a result, your script most likely can't find/can't execute ifconfig
. 结果,您的脚本极有可能找不到/无法执行
ifconfig
。
Specify full paths to everything within your hook scripts. 在钩子脚本中指定所有内容的完整路径。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.