Webtau can run commands in foreground and in background . When command is ran in foreground webtau will wait for the command to finish.To run a command use with a single string parameter that includes a command and all its arguments:'echo hello world')

Run With Validation'echo hello world') { output.should contain('hello') output.should contain('world') }'scripts/error-output') { error.should == 'error B892T' }'scripts/exit-code 8') { exitCode.should == 8 exitCode.shouldNot == 0 }

Implicit Exit Code Validation

Webtau performs implicit exit code validation and adds exitCode equals zero when you don't specify explicit exitCode validation.'echo hello world') Example above is equivalent to'echo hello world') { exitCode.should == 0 }

Run Result

Use the result of if you need to process the output of the command. def result ='echo hello world') println result.output println result.error if (result.exitCode == 1) { // ... } Warning: Perform validation inside validation block so webtau can track what was checked.

Working Dir

Use cli.workingDir as a second parameter to to set a working dir:'./listing', cli.workingDir('../scripts')) { output.should contain('listing files') output.should contain('sleeps') }

Environment Variables

Use cli.env as a second parameter to to set the environment variables:'scripts/hello-env-var', cli.env([my_var: 'webtau'])) { output.should == 'hello webtau' }

Chain Cli Run Config

Combine configs by using cli.env(...).workingDir(...) in any order to set both:'./hello-env-var', cli.workingDir('../scripts').env([my_var: 'webtau'])) { output.should == 'hello webtau' }