fixed race condition/off-by-one error in reading stdout/stderr
updated spec assertions as per depreciation notice