问题描述
我正在写在bash后提交脚本,我想传递消息回谁在作出承诺的客户端。然而
I'm writing a post-commit script in bash, and I'd like to pass messages back to the client who's making a commit. However
echo my message >&2
不使它返回给客户端。它甚至有可能将消息发送回一个post-commit钩子?
isn't making it back to the client. Is it even possible to send messages back with a post-commit hook?
推荐答案
Condering一个的做:
Condering a post-commit hook does:
任何输出到stderr的钩子将被编组回客户端,使其更容易诊断钩子的失败。
您可以检查,如果这不是一个简单的问题帖:
you can check if this isn't a simple quote issue:
echo "my message" >&2
您可以在那些钩范例任何回声
到>&安培; 2
包括引号
You can see in those hook examples that any echo
to >&2
includes quotes.
在重定向的还包括与报价的例子。
The bash chapter on redirection also includes examples with quotes.
然而,如在的细节=http://stackoverflow.com/a/8427369/ 6309的,除非脚本的退出状态由0不同,使用中所示的标准错误信息将不可见=http://serverfault.com/a/386219/ 783>颠覆post-commit钩子:打印错误的信息,即用户可以看到
However, as pmod details in his answer, that stderr message won't be visible unless the exit status of the script differs from 0, as illustrated in "subversion post-commit hook: print an error message that the user can see?"
#!/bin/bash
echo "test" >&2
exit 1
这篇关于SVN post-commit钩子发送消息给客户端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!