small rewrite of shell adapter

aiming for simplicity, also returns the right error of `writeString`