node-nikita icon indicating copy to clipboard operation
node-nikita copied to clipboard

add grep options on @execute

Open Pierrotws opened this issue 8 years ago • 0 comments

We often use bash grep to check output of a command, and return 1 (mecano fail) if not found. Works great, but we loose the output of the firt command.

@execute
  cmd: 'ps aux | grep toto'
, (err, out, err) -> //out contains toto if found, else is empty

Solution could be:

@execute
  cmd: 'ps aux'
  grep: 'toto'
, (err, out, err) -> //out contains ps aux output

Also , would support regexp :

@execute
  cmd: 'ps aux'
  grep: /t.to/
, (err, out, err) -> //out contains ps aux output

Pierrotws avatar Mar 24 '16 13:03 Pierrotws