return the error from `Flush` instead of `WriteString`
small rewrite
Merge pull request #11 from mvrilo/master

small rewrite of shell adapter