Skip to content

Commit 95afa69

Browse files
authored
Merge pull request #11 from itk-devops/fix/propagate-command-exit-code
fix: propagate command exit code instead of swallowing failures
2 parents d7195ab + 0a720c9 commit 95afa69

3 files changed

Lines changed: 10 additions & 3 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
* [PR-12](https://github.com/itk-devops/devops_itkdev-docker-server/pull/12)
1111
Clean up Taskfile and dev tooling for `docker compose`.
12+
* [PR-11](https://github.com/itk-devops/devops_itkdev-docker-server/pull/11)
13+
Propagate command exit code instead of swallowing failed docker compose
14+
commands.
1215

1316
## [0.0.14] - 2025-03-26
1417

‎src/commands/docker.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ exports.handler = function (argv: { [x: string]: any; base: string; debug: any;
1313

1414
// Test env file exists.
1515
if (!utils.isFile(argv.base + '/' + env)) {
16-
console.error('The env file not found!');
17-
return;
16+
console.error(`The env (${env}) file not found!`);
17+
process.exit(1);
1818
}
1919

2020
// Hack to parse the commands that should be sendt to docker.

‎src/modules/docker.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,11 @@ export default class Docker {
8383
if (err instanceof Error) {
8484
console.error(err.message);
8585
}
86-
return null;
86+
87+
// Propagate the failed command's exit code so callers (CI, Ansible)
88+
// detect the failure instead of seeing a false success.
89+
const status = (err as {status?: number | null}).status;
90+
process.exit(typeof status === 'number' ? status : 1);
8791
}
8892
}
8993
}

0 commit comments

Comments
 (0)