| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 3f5e09c commit 6b6871f
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -86,8 +86,22 @@ function expectSyncExit(caller, spawnArgs, { | |||
| 86 | 86 | console.error(`${tag} status = ${child.status}, signal = ${child.signal}`); | |
| 87 | 87 | ||
| 88 | 88 | const error = new Error(`${failures.join('\n')}`); | |
| 89 | - if (spawnArgs[2]) { | ||
| 90 | - error.options = spawnArgs[2]; | ||
| 89 | + if (typeof spawnArgs[2] === 'object' && spawnArgs[2] !== null) { | ||
| 90 | + const envInOptions = spawnArgs[2].env; | ||
| 91 | + // If the env is overridden in the spawn options, include it in the error | ||
| 92 | + // object for easier debugging. | ||
| 93 | + if (typeof envInOptions === 'object' && envInOptions !== null && envInOptions !== process.env) { | ||
| 94 | + // Only include the environment variables that are different from | ||
| 95 | + // the current process.env to avoid cluttering the output. | ||
| 96 | + error.options = { ...spawnArgs[2], env: {} }; | ||
| 97 | + for (const key of Object.keys(envInOptions)) { | ||
| 98 | + if (envInOptions[key] !== process.env[key]) { | ||
| 99 | + error.options.env[key] = spawnArgs[2].env[key]; | ||
| 100 | + } | ||
| 101 | + } | ||
| 102 | + } else { | ||
| 103 | + error.options = spawnArgs[2]; | ||
| 104 | + } | ||
| 91 | 105 | } | |
| 92 | 106 | let command = spawnArgs[0]; | |
| 93 | 107 | if (Array.isArray(spawnArgs[1])) { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments