Fix some problems with the implementation of SHELL on non-Microsoft platforms
1) When executed synchronously, it will does not freeze the UI (although it still can't be halted)
2) When executed asynchronously, the return code is calculated correctly (although it always seems to be true)