Skip to content

Commit

Permalink
log stdout and stderr
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-harvey committed Feb 28, 2024
1 parent 3263362 commit 446bb81
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
9 changes: 7 additions & 2 deletions build/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24746,6 +24746,7 @@ const NodeTypeToGoOs = {
Darwin: "darwin",
Linux: "linux",
};
// https://goreleaser.com/customization/builds/?h=guarantee#a-note-about-folder-names-inside-dist
function getArtifactPath() {
let data;
try {
Expand All @@ -24771,9 +24772,13 @@ function main() {
const path = getArtifactPath();
const returns = (0, child_process_1.spawnSync)(path, args);
const status = (_a = returns.status) !== null && _a !== void 0 ? _a : 1;
const stdout = returns.stdout.toString();
const stderr = returns.stderr.toString();
console.log(stdout);
console.error(stderr);
core.setOutput("exit-code", status);
core.setOutput("output", returns.stdout.toString());
core.setOutput("error-output", returns.stderr.toString());
core.setOutput("output", stdout);
core.setOutput("error-output", stderr);
process.exit(status);
}
if (require.main === require.cache[eval('__filename')]) {
Expand Down
2 changes: 1 addition & 1 deletion build/index.js.map

Large diffs are not rendered by default.

12 changes: 10 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,17 @@ function main() {
const path = getArtifactPath();
const returns = spawnSync(path, args);
const status = returns.status ?? 1;

const stdout = returns.stdout.toString();
const stderr = returns.stderr.toString();

console.log(stdout);
console.error(stderr);

core.setOutput("exit-code", status);
core.setOutput("output", returns.stdout.toString());
core.setOutput("error-output", returns.stderr.toString());
core.setOutput("output", stdout);
core.setOutput("error-output", stderr);

process.exit(status);
}

Expand Down

0 comments on commit 446bb81

Please sign in to comment.