[headless] report output from commands/queries that were executed

Also, add some negative test cases.