本文介绍了正从蚂蚁合式输出 - sshexec在Groovy脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题是,从蚂蚁任务的输出alwas的开头部分[SSH-EXEC]信息文本。我可以燮preSS /禁用?

my problem is, that the output from the ant task alwas has some [ssh-exec] infotext at the beginning. can i suppress / disable that?

我的code迄今:

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'

这篇关于正从蚂蚁合式输出 - sshexec在Groovy脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-12 05:22