从 ant - sshexec 在 groovy 脚本中获得格式良好的输出 [英] getting well formed output from ant - sshexec in groovy script
本文介绍了从 ant - sshexec 在 groovy 脚本中获得格式良好的输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的问题是,ant 任务的输出在开头总是有一些 [ssh-exec] 信息文本.我可以抑制/禁用它吗?
my problem is, that the output from the ant task alwas has some [ssh-exec] infotext at the beginning. can i suppress / disable that?
到目前为止我的代码:
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 中获得原始输出...
i just want to have the raw output from the cmd i execute...
一些想法?!
推荐答案
您可以将原始输出保存在 Ant 属性中:
You can save the raw output inside an Ant property:
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'
这篇关于从 ant - sshexec 在 groovy 脚本中获得格式良好的输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文