child_process: do not access stderr when stdio set to 'ignore'

Currently, `checkExecSyncError()` attempts to access the contents of `stderr`. When `stdio` is set to `'ignore'`, this causes a crash. This commit adds a check on the access of `stderr`. Closes #7966.