child_process: remove extra newline in errors
Checklist
-
make -j8 test
(UNIX), orvcbuild test nosign
(Windows) passes -
tests and/or benchmarks are included -
commit message follows commit guidelines
Affected core subsystem(s)
child_process
Description of change
checkExecSyncError()
creates error objects for execSync()
and execFileSync()
. If the child process created stderr
output, then it is attached to the end of the error message. However, stderr
can be an empty Buffer
object, which always passes the truthy check, leading to an extra newline in the error message. This commit adds a length check, which will work with both strings and Buffer
s.