我的问题是,ant 任务的输出总是在开头有一些 [ssh-exec] 信息文本。我可以抑制/禁用它吗?
到目前为止我的代码:
def ant = new AntBuilder()
// .... variable definition ...
ant.sshexec(host: host,
port: port,
trust: true,
username: username,
password: password,
command: 'ls')
>>> output:
[sshexec] Connecting to foomachine.local:22
[sshexec] cmd : ls
[sshexec] oldarchive.gz
[sshexec] newarchive.gz
[sshexec] empty-db.sh
[sshexec] testfile.py
我只想获得我执行的 cmd 的原始输出...
一些想法?!
您可以将原始输出保存在 Ant 属性中:
def ant = new AntBuilder()
ant.sshexec(host: host,
port: port,
trust: true,
username: username,
password: password,
command: 'ls',
outputproperty: 'result')
def result = ant.project.properties.'result'
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)