Skip to content

Commit

Permalink
changes as requested
Browse files Browse the repository at this point in the history
  • Loading branch information
gauravsaini04 committed Jun 21, 2024
1 parent c90ce09 commit 1ce0373
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions src/spec-node/dockerCompose.ts
Original file line number Diff line number Diff line change
Expand Up @@ -703,30 +703,26 @@ export function dockerComposeCLIConfig(params: Omit<PartialExecParameters, 'cmd'
let result: Promise<DockerComposeCLI>;
return () => {
return result || (result = (async () => {
let v2 = false;
let v2 = true;
let stdout: Buffer;
dockerCLICmd='docker-compose';
try {
stdout = (await dockerComposeCLI({
...params,
cmd: dockerComposeCLICmd,
}, 'version', '--short')).stdout;
cmd: dockerCLICmd,
}, 'compose', 'version', '--short')).stdout;
v2 = true;
} catch (err) {
if (err?.code !== 'ENOENT') {
throw err;
}
stdout = (await dockerComposeCLI({
...params,
cmd: dockerCLICmd,
cmd: dockerComposeCLICmd,
}, 'version', '--short')).stdout;
v2 = true;
}
const version = stdout.toString().trim();
params.output.write(`Docker Compose version: ${version}`);
return {
version,
cmd: v2 ? dockerCLICmd : dockerComposeCLICmd,
args: v2 ? [] : ['compose'],
args: v2 ? ['compose'] : [],
};
})());
};
Expand Down

0 comments on commit 1ce0373

Please sign in to comment.