feat(update): show stderr for failed steps
This commit is contained in:
committed by
Peter Steinberger
parent
3f27b23d5a
commit
6cb55eaaa7
@@ -64,6 +64,15 @@ function createUpdateProgress(enabled: boolean): ProgressController {
|
|||||||
|
|
||||||
currentSpinner.stop(`${icon} ${label} ${duration}`);
|
currentSpinner.stop(`${icon} ${label} ${duration}`);
|
||||||
currentSpinner = null;
|
currentSpinner = null;
|
||||||
|
|
||||||
|
if (step.exitCode !== 0 && step.stderrTail) {
|
||||||
|
const lines = step.stderrTail.split("\n").slice(-10);
|
||||||
|
for (const line of lines) {
|
||||||
|
if (line.trim()) {
|
||||||
|
defaultRuntime.log(` ${theme.error(line)}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ export type UpdateStepInfo = {
|
|||||||
export type UpdateStepCompletion = UpdateStepInfo & {
|
export type UpdateStepCompletion = UpdateStepInfo & {
|
||||||
durationMs: number;
|
durationMs: number;
|
||||||
exitCode: number | null;
|
exitCode: number | null;
|
||||||
|
stderrTail?: string | null;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type UpdateStepProgress = {
|
export type UpdateStepProgress = {
|
||||||
@@ -199,10 +200,13 @@ async function runStep(opts: RunStepOptions): Promise<UpdateStepResult> {
|
|||||||
const result = await runCommand(argv, { cwd, timeoutMs, env });
|
const result = await runCommand(argv, { cwd, timeoutMs, env });
|
||||||
const durationMs = Date.now() - started;
|
const durationMs = Date.now() - started;
|
||||||
|
|
||||||
|
const stderrTail = trimLogTail(result.stderr, MAX_LOG_CHARS);
|
||||||
|
|
||||||
progress?.onStepComplete?.({
|
progress?.onStepComplete?.({
|
||||||
...stepInfo,
|
...stepInfo,
|
||||||
durationMs,
|
durationMs,
|
||||||
exitCode: result.code,
|
exitCode: result.code,
|
||||||
|
stderrTail,
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user