Skip to content
This repository was archived by the owner on Nov 20, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions system-test/test.kitchen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,25 @@ let stagingDir: string;
async function run(...params: Parameters<typeof spawn>) {
const command = spawn(...params);

function stdout(str: string) {
const prefix = '\n>>> STDOUT: ';
console.log(prefix + str.replace(/\n/g, prefix));
}

function stderr(str: string) {
const prefix = '\n>>> STDERR: ';
console.error(prefix + str.replace(/\n/g, prefix));
}

await new Promise<void>((resolve, reject) => {
// Unlike `exec`/`execFile`, this keeps the order of STDOUT/STDERR in case they were interweaved;
// making it easier to debug and follow along.
command.stdout?.on('data', console.log);
command.stderr?.on('data', console.error);
command.stdout?.setEncoding('utf8');
command.stderr?.setEncoding('utf8');

command.stdout?.on('data', stdout);
command.stderr?.on('data', stderr);

command.on('close', (code, signal) => {
return code === 0 ? resolve() : reject({code, signal});
});
Expand Down
Loading