Fix traceback when cwd does not exist

Fixes #7154.
Catch OSError, IOError when attempting to spawn subprocess
Merge pull request #7160 from terminalmage/issue7154

Fix traceback when cwd does not exist