fix a bug of getting return code
Merge pull request #370 from wakamori/fix_shell

fix a bug of getting return code