emit returncode in shell; fixes #1371