mirror of
https://github.com/renovatebot/github-action.git
synced 2025-12-17 01:12:35 +00:00
fix: use async/await for exec
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
This commit is contained in:
parent
b435cadb65
commit
cd7e423dd8
1 changed files with 14 additions and 22 deletions
|
|
@ -20,28 +20,20 @@ class Renovate {
|
|||
}
|
||||
|
||||
runDockerContainer(): Promise<void> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const commandArguments = [
|
||||
'--rm',
|
||||
`--env ${this.configFileEnv}=${this.configFileMountPath()}`,
|
||||
`--env ${this.tokenEnv}=${this.token}`,
|
||||
`--volume ${this.configFile}:${this.configFileMountPath()}`,
|
||||
this.docker.image(),
|
||||
];
|
||||
const command = `docker run ${commandArguments.join(' ')}`;
|
||||
|
||||
exec(command)
|
||||
.then((code) => {
|
||||
if (code === 0) {
|
||||
resolve();
|
||||
} else {
|
||||
reject(new Error(`'docker run' failed with exit code ${code}.`));
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
const commandArguments = [
|
||||
'run',
|
||||
'--rm',
|
||||
`--env ${this.configFileEnv}=${this.configFileMountPath()}`,
|
||||
`--env ${this.tokenEnv}=${this.token}`,
|
||||
`--volume ${this.configFile}:${this.configFileMountPath()}`,
|
||||
this.docker.image(),
|
||||
];
|
||||
const command = `docker`;
|
||||
|
||||
const code = exec(command, commandArguments);
|
||||
if (code !== 0) {
|
||||
new Error(`'docker run' failed with exit code ${code}.`);
|
||||
}
|
||||
}
|
||||
|
||||
private validateArguments(): void {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue