Skip to content

Commit 2b197b7

Browse files
Merge pull request #834 from mvhenderson/734-fix-compose-on-windows
use docker-compose.exe on windows
2 parents 753445c + b2843ed commit 2b197b7

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/utils/index.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,8 @@ export async function portFromDockerCompose(): Promise<{ port: number; docker: b
382382
}
383383

384384
const envFileParam = envFile ? `--env-file ${envFile}` : "";
385-
const cmd = `docker-compose -f ${file} ${envFileParam} `;
385+
const exe = process.platform === "win32" ? "docker-compose.exe" : "docker-compose";
386+
const cmd = `${exe} -f ${file} ${envFileParam} `;
386387

387388
return new Promise((resolve, reject) => {
388389
exec(`${cmd} ps --services --filter status=running`, { cwd }, (error, stdout) => {
@@ -415,7 +416,8 @@ export async function terminalWithDocker(): Promise<vscode.Terminal> {
415416
const terminalName = `ObjectScript:${workspace}`;
416417
let terminal = terminals.find((t) => t.name == terminalName && t.exitStatus == undefined);
417418
if (!terminal) {
418-
terminal = vscode.window.createTerminal(terminalName, "docker-compose", [
419+
const exe = process.platform === "win32" ? "docker-compose.exe" : "docker-compose";
420+
terminal = vscode.window.createTerminal(terminalName, exe, [
419421
"-f",
420422
file,
421423
"exec",
@@ -439,7 +441,8 @@ export async function shellWithDocker(): Promise<vscode.Terminal> {
439441
const terminalName = `Shell:${workspace}`;
440442
let terminal = terminals.find((t) => t.name == terminalName && t.exitStatus == undefined);
441443
if (!terminal) {
442-
terminal = vscode.window.createTerminal(terminalName, "docker-compose", ["-f", file, "exec", service, "/bin/bash"]);
444+
const exe = process.platform === "win32" ? "docker-compose.exe" : "docker-compose";
445+
terminal = vscode.window.createTerminal(terminalName, exe, ["-f", file, "exec", service, "/bin/bash"]);
443446
terminals.push(terminal);
444447
}
445448
terminal.show(true);

0 commit comments

Comments
 (0)