diff options
Diffstat (limited to 'yarns/900-implements.yarn')
-rw-r--r-- | yarns/900-implements.yarn | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/yarns/900-implements.yarn b/yarns/900-implements.yarn index 5b9d0f9..d4b1ee5 100644 --- a/yarns/900-implements.yarn +++ b/yarns/900-implements.yarn @@ -15,3 +15,24 @@ Does the server respond to a ping? IMPLEMENTS THEN server responds to ping . "$DATADIR/config.sh" ping -c1 "$SERVER" + +## Running command over ssh + +Run a command on the server over ssh, capturing stdout and stderr and +exit code for later inspection. + + IMPLEMENTS WHEN running ssh (.*) + if ssh $MATCH_1 > "$DATADIR/stdout" 2> "$DATADIR/stderr" + then + echo 0 > "$DATADIR/exit" + else + echo $? > "$DATADIR/exit" + fi + +## Inspect results of running a command + +The stdout, stderr, and exit code have been saved. Inspect them. + + IMPLEMENTS THEN output matches (.+) + cat "$DATADIR/stdout" + grep "$MATCH_1" "$DATADIR/stdout" |