fixed issue with multiple args for entrypoint

Signed-off-by: Luca Stocchi <lstocchi@redhat.com>
This commit is contained in:
Luca Stocchi 2020-11-07 13:25:52 +01:00
parent 69952a8f62
commit 652179bd8c
No known key found for this signature in database
GPG key ID: 930BB00F3FCF30A4
4 changed files with 19 additions and 5 deletions

2
dist/index.js vendored

File diff suppressed because one or more lines are too long

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View file

@ -43,11 +43,11 @@ class BuildahCli {
const args = ['config'];
if (settings.entrypoint) {
args.push('--entrypoint');
args.push(...settings.entrypoint);
args.push(this.convertArrayToStringArg(settings.entrypoint));
}
if (settings.port) {
args.push('--port');
args.push(...settings.port);
args.push(settings.port);
}
args.push(container);
return yield this.execute(args);
@ -62,6 +62,13 @@ class BuildahCli {
return yield this.execute(args);
});
}
convertArrayToStringArg(args) {
let arrayAsString = '[';
args.forEach(arg => {
arrayAsString += `"${arg}",`;
});
return `${arrayAsString.slice(0, -1)}]`;
}
execute(args) {
return __awaiter(this, void 0, void 0, function* () {
if (!this.executable) {

View file

@ -59,7 +59,7 @@ export class BuildahCli implements Buildah {
const args: string[] = ['config'];
if (settings.entrypoint) {
args.push('--entrypoint');
args.push(...settings.entrypoint);
args.push(this.convertArrayToStringArg(settings.entrypoint));
}
if (settings.port) {
args.push('--port');
@ -76,6 +76,13 @@ export class BuildahCli implements Buildah {
return await this.execute(args);
}
private convertArrayToStringArg(args: string[]): string {
let arrayAsString = '[';
args.forEach(arg => {
arrayAsString += `"${arg}",`;
});
return `${arrayAsString.slice(0, -1)}]`;
}
private async execute(args: string[]): Promise<CommandResult> {
if (!this.executable) {