Skip to content

Commit

Permalink
More CI debugging: print stderr on failure
Browse files Browse the repository at this point in the history
  • Loading branch information
dherman committed Mar 10, 2021
1 parent 20727be commit 993d106
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
3 changes: 3 additions & 0 deletions create-neon/dev/expect.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ChildProcess } from 'child_process';
import { PassThrough, Readable, Writable } from 'stream';
import { StringDecoder } from 'string_decoder';
import readStream from 'stream-to-string';

function readChunks(input: Readable): Readable {
let output = new PassThrough({ objectMode: true });
Expand Down Expand Up @@ -96,13 +97,15 @@ export default async function expect(child: ChildProcess, script: Record<string,
for await (let lines of run(script, child.stdin!, child.stdout!)) {
output.push(lines);
}
let stderr = await readStream(child.stderr!);
let code = await exit(child);
switch (code) {
case null:
throw new ChildError("child process interrupted", output);
case 0:
return;
default:
console.log("stderr: " + stderr);
throw new ChildError("child process exited with code " + code, output);
}
}
15 changes: 15 additions & 0 deletions create-neon/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions create-neon/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"execa": "^5.0.0",
"mocha": "^8.3.1",
"rimraf": "^3.0.2",
"stream-to-string": "^1.2.0",
"toml": "^3.0.0",
"ts-node": "^9.1.1",
"typescript": "^4.2.2"
Expand Down
2 changes: 1 addition & 1 deletion create-neon/test/create-neon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ describe('Project creation', () => {
'Is this OK?': ''
});
} catch (error) {
console.log(error.output);
console.log("stdout lines: " + error.output);
assert.fail("create-neon unexpectedly failed: " + error.message);
}

Expand Down

0 comments on commit 993d106

Please sign in to comment.