diff --git a/src/docker/install.ts b/src/docker/install.ts index b6552240..d3243cb2 100644 --- a/src/docker/install.ts +++ b/src/docker/install.ts @@ -111,7 +111,7 @@ export class Install { return tooldir; } - public async install(): Promise { + public async install(): Promise { if (!this.toolDir) { throw new Error('toolDir must be set. Run download first.'); } @@ -120,16 +120,13 @@ export class Install { } switch (os.platform()) { case 'darwin': { - await this.installDarwin(); - break; + return await this.installDarwin(); } case 'linux': { - await this.installLinux(); - break; + return await this.installLinux(); } case 'win32': { - await this.installWindows(); - break; + return await this.installWindows(); } default: { throw new Error(`Unsupported platform: ${os.platform()}`); @@ -137,7 +134,7 @@ export class Install { } } - private async installDarwin(): Promise { + private async installDarwin(): Promise { const limaDir = path.join(os.homedir(), '.lima', this.limaInstanceName); await io.mkdirP(limaDir); const dockerHost = `unix://${limaDir}/docker.sock`; @@ -225,9 +222,11 @@ export class Install { await Exec.exec('docker', ['context', 'create', this.contextName, '--docker', `host=${dockerHost}`]); await Exec.exec('docker', ['context', 'use', this.contextName]); }); + + return dockerHost; } - private async installLinux(): Promise { + private async installLinux(): Promise { const dockerHost = `unix://${path.join(this.runDir, 'docker.sock')}`; await io.mkdirP(this.runDir); @@ -306,9 +305,11 @@ EOF`, await Exec.exec('docker', ['context', 'create', this.contextName, '--docker', `host=${dockerHost}`]); await Exec.exec('docker', ['context', 'use', this.contextName]); }); + + return dockerHost; } - private async installWindows(): Promise { + private async installWindows(): Promise { const dockerHost = 'npipe:////./pipe/setup_docker_action'; let daemonConfig = undefined; @@ -347,6 +348,8 @@ EOF`, await Exec.exec('docker', ['context', 'create', this.contextName, '--docker', `host=${dockerHost}`]); await Exec.exec('docker', ['context', 'use', this.contextName]); }); + + return dockerHost; } public async tearDown(): Promise {