Skip to content

Commit

Permalink
Revert logging to stdout and stderr
Browse files Browse the repository at this point in the history
revert 5788f8a
  • Loading branch information
arturcic committed Nov 20, 2024
1 parent 1edd09a commit d4a0021
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 38 deletions.
2 changes: 1 addition & 1 deletion dist/tools/cli.mjs.map

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

10 changes: 1 addition & 9 deletions dist/tools/lib.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { parseArgs } from 'node:util';
import process from 'node:process';

async function getAgent(buildAgent) {
const agent = `./${buildAgent}/agent.mjs`;
Expand All @@ -23,14 +22,7 @@ function parseCliArgs() {
}
async function run(agent, tool, command) {
const runner = await getToolRunner(agent, tool);
const { code, stdout, stderr } = await runner.run(command);
if (stdout) {
process.stdout.write(stdout);
}
if (stderr) {
process.stderr.write(stderr);
}
process.exitCode = code;
return await runner.run(command);
}

export { getAgent, getToolRunner, parseCliArgs, run };
Expand Down
2 changes: 1 addition & 1 deletion dist/tools/lib.mjs.map

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

3 changes: 1 addition & 2 deletions src/tools/cli.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { parseCliArgs, run } from '@lib'
import { type Commands } from '@tools/gitversion'

const { agent, tool, command } = parseCliArgs()
await run(agent, tool, command as Commands)
await run(agent, tool, command)
7 changes: 0 additions & 7 deletions src/tools/gitreleasemanager/main.ts

This file was deleted.

7 changes: 0 additions & 7 deletions src/tools/gitversion/main.ts

This file was deleted.

14 changes: 3 additions & 11 deletions src/tools/lib.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { parseArgs } from 'node:util'
import process from 'node:process'

import { type IBuildAgent } from '@agents/common'
import { type ExecResult, type IBuildAgent } from '@agents/common'
import { type IRunner } from '@tools/common'

type CliArgs = {
Expand Down Expand Up @@ -33,14 +32,7 @@ export function parseCliArgs(): CliArgs {
}).values as CliArgs
}

export async function run(agent: string, tool: string, command: string): Promise<void> {
export async function run(agent: string, tool: string, command: string): Promise<ExecResult> {
const runner = await getToolRunner(agent, tool)
const { code, stdout, stderr } = await runner.run(command)
if (stdout) {
process.stdout.write(stdout)
}
if (stderr) {
process.stderr.write(stderr)
}
process.exitCode = code
return await runner.run(command)
}

0 comments on commit d4a0021

Please sign in to comment.