use of com.cloud.utils.script.OutputInterpreter in project cloudstack by apache.
the class ScriptTest method executeWithOutputInterpreter.
@Test
public void executeWithOutputInterpreter() {
Assume.assumeTrue(SystemUtils.IS_OS_LINUX);
Script script = new Script("/bin/bash");
script.add("-c");
script.add("echo 'hello world!'");
String value = script.execute(new OutputInterpreter() {
@Override
public String interpret(BufferedReader reader) throws IOException {
throw new IllegalArgumentException();
}
});
// it is a stack trace in this case as string
Assert.assertNotNull(value);
}
Aggregations