I am trying to get command output from a Linux window
for example: tnsping
and I want to keep newline characters.
Below is the code where I add the commands (s) to frows and pass them functions to execute
def oracleCommand(csm,pluginOutputs) { HashMap<String,String> params = IntermediateResults.get("userparams") Map env=AppContext.get(AppCtxProperties.environmentVariables) def fClass = new GroovyClassLoader().parseClass( new File( 'plugins/infa9/Infa9CommandExecUtil.groovy' ) ) List<String> frows frows=["tnsping $params.tns"]
In the code below, I am reading the result, the result of splitting based on new lines, so all my translation characters are not displayed
public List<String> fetchCommandOutput( Map<String,String> params, Map env, List<String> rows ) { List<String> outputRows = new ArrayList<String>() try { for(item in rows) { String temp=item.toString() Process proc = Runtime.getRuntime().exec(temp); InputStream stdin = proc.getInputStream(); InputStreamReader isr = new InputStreamReader(stdin); BufferedReader br = new BufferedReader(isr); String line = null; result = new StringBuffer() line=null while ((line = br.readLine()) != null) { result.append(line+" #10#13 ")
Update How can I save my newlines or carriage returns so that when xml is opened using xsl and when <pre></pre> is encountered, should it retain its formatting?
source share