org.apache.itest.shell
Class Shell
java.lang.Object
org.apache.itest.shell.Shell
- All Implemented Interfaces:
- groovy.lang.GroovyObject
public class Shell
- extends Object
- implements groovy.lang.GroovyObject
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Shell
public Shell(String sh)
Shell
public Shell(String sh,
String u)
getShell
public String getShell()
setShell
public void setShell(String value)
getUser
public String getUser()
getScript
public String getScript()
setScript
public void setScript(String value)
getOut
public List getOut()
setOut
public void setOut(List value)
getErr
public List getErr()
setErr
public void setErr(List value)
getRet
public int getRet()
setRet
public void setRet(int value)
setUser
public void setUser(String u)
exec
public Shell exec(Object args)
- Execute shell script consisting of as many Strings as we have arguments,
possibly under an explicit username (requires sudoers privileges).
NOTE: individual strings are concatenated into a single script as though
they were delimited with new line character. All quoting rules are exactly
what one would expect in standalone shell script.
After executing the script its return code can be accessed as getRet(),
stdout as getOut() and stderr as getErr(). The script itself can be accessed
as getScript()
WARNING: it isn't thread safe
- Parameters:
args
- shell script split into multiple Strings
- Returns:
- Shell object for chaining
getMetaClass
public groovy.lang.MetaClass getMetaClass()
- Specified by:
getMetaClass
in interface groovy.lang.GroovyObject
setMetaClass
public void setMetaClass(groovy.lang.MetaClass metaClass)
- Specified by:
setMetaClass
in interface groovy.lang.GroovyObject
invokeMethod
public Object invokeMethod(String name,
Object args)
- Specified by:
invokeMethod
in interface groovy.lang.GroovyObject
getProperty
public Object getProperty(String name)
- Specified by:
getProperty
in interface groovy.lang.GroovyObject
setProperty
public void setProperty(String name,
Object value)
- Specified by:
setProperty
in interface groovy.lang.GroovyObject
Copyright © 2011. All Rights Reserved.