0
0
mirror of https://github.com/renovatebot/renovate.git synced 2024-12-31 09:28:59 +00:00
renovatebot_renovate/lib/util/exec/exec-error.ts
Gabriel-Ladzaretti 892595aea8
feat(util/exec): use spawn instead of exec (#16414)
* refactor(util): use spawn instead of exec

 - Use child_process.spawn instead of child_process.exec

* refactor(util): use spawn instead of exec

 - Use child_process.spawn instead of child_process.exec

* refactor(util): use spawn instead of exec

 - Use child_process.spawn instead of child_process.exec

* refactor(util): use spawn instead of exec

 - Use child_process.spawn instead of child_process.exec

* refactor(util): use spawn instead of exec

 - init spawn-util

* refactor(util): use spawn instead of exec

 - spawn-util

* refactor(util): use spawn instead of exec

 - init index-spawn.spec.ts

* refactor(util): use spawn instead of exec

 - fixed various tests

* refactor(util): use spawn instead of exec

 - fix all artifacts.spec.ts

* refactor(util): use spawn instead of exec

 - fix all artifacts.spec.ts

* refactor(util): use spawn instead of exec

 - fix npm post update imports

* refactor(util): use spawn instead of exec

 - revert renaming to minimize PR diff

* refactor(util): use spawn instead of exec

 - revert renaming to minimize PR diff

* refactor(util): use spawn instead of exec

 - revert renaming to minimize PR diff

* refactor(util): use spawn instead of exec

 - revert renaming to minimize PR diff

* refactor(util): use spawn instead of exec

 - revert renaming to minimize PR diff
 - destroy stdio when terminating child process

* refactor(util): use spawn instead of exec

 - delete and revert dev related changes

* refactor(util): use spawn instead of exec
 - fix support for windows

* refactor(util): use spawn instead of exec

 - handle SIGSTOP and such
 - add test coverage

* refactor(util): use spawn instead of exec

 - now converts to strings when resolving/rejecting

* refactor(util): use spawn instead of exec

 - logs improvements
 - force shell (exec like)
 - fix tests

* refactor(util): use spawn instead of exec

 - strongly type listeners

* refactor(util): use spawn instead of exec

 - create helper mock for spawn

* refactor(util): use spawn instead of exec

 - cr changes

* Update lib/util/exec/common.ts

Co-authored-by: Sergei Zharinov <zharinov@users.noreply.github.com>

* refactor(util): use spawn instead of exec

 - documentation

* refactor(util): use spawn instead of exec

 - revert unnecessary formatting

* refactor(util): use spawn instead of exec

* refactor(util): use spawn instead of exec

 - added ExecError class

* refactor(util): use spawn instead of exec

 - exec-error.ts restructure

* refactor(util): use spawn instead of exec

* Apply suggestions from code review

Co-authored-by: Sergei Zharinov <zharinov@users.noreply.github.com>

* refactor(util): use spawn instead of exec

* refactor(util): use spawn instead of exec

* refactor(util): use spawn instead of exec

 - deprecated RawExecOptions.encoding property

* refactor(util): use spawn instead of exec

* refactor(util): use spawn instead of exec

* refactor(util): use spawn instead of exec

Co-authored-by: Sergei Zharinov <zharinov@users.noreply.github.com>
2022-07-22 15:43:28 +00:00

45 lines
850 B
TypeScript

import type { RawExecOptions } from './types';
export interface ExecErrorData {
cmd: string;
stderr: string;
stdout: string;
options: RawExecOptions;
exitCode?: number;
signal?: NodeJS.Signals;
}
export class ExecError extends Error {
cmd: string;
stderr: string;
stdout: string;
options: RawExecOptions;
exitCode?: number;
signal?: NodeJS.Signals;
err?: Error;
constructor(message: string, data: ExecErrorData, err?: Error) {
const { cmd, exitCode, stderr, stdout, options, signal } = data;
super(message);
this.name = this.constructor.name;
this.cmd = cmd;
this.stderr = stderr;
this.stdout = stdout;
this.options = options;
if (exitCode) {
this.exitCode = exitCode;
}
if (signal) {
this.signal = signal;
}
if (err) {
this.err = err;
}
}
}