diff --git a/spec-main/chromium-spec.ts b/spec-main/chromium-spec.ts
index f8a28f600a9..844996c2b75 100644
--- a/spec-main/chromium-spec.ts
+++ b/spec-main/chromium-spec.ts
@@ -318,8 +318,14 @@ describe('command line switches', () => {
 
       let output = '';
       appProcess.stdout.on('data', (data) => { output += data; });
+      let stderr = '';
+      appProcess.stderr.on('data', (data) => { stderr += data; });
+
+      const [code, signal] = await emittedOnce(appProcess, 'exit');
+      if (code !== 0) {
+        throw new Error(`Process exited with code "${code}" signal "${signal}" output "${output}" stderr "${stderr}"`);
+      }
 
-      await emittedOnce(appProcess.stdout, 'end');
       output = output.replace(/(\r\n|\n|\r)/gm, '');
       expect(output).to.equal(result);
     };