Skip to content

Commit

Permalink
Handle docker not existing
Browse files Browse the repository at this point in the history
  • Loading branch information
Hoverbear committed Jan 9, 2024
1 parent 21affdd commit 81ee88f
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 33 deletions.
39 changes: 23 additions & 16 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

39 changes: 23 additions & 16 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,23 +129,30 @@ class NixInstallerAction {
actions_core.debug(
"Linux detected without systemd, testing for Docker with `docker info` as an alternative daemon supervisor.",
);
const exit_code = await actions_exec.exec("docker", ["info"], {
silent: true,
listeners: {
stdout: (data: Buffer) => {
const trimmed = data.toString("utf-8").trimEnd();
if (trimmed.length >= 0) {
actions_core.debug(trimmed);
}
},
stderr: (data: Buffer) => {
const trimmed = data.toString("utf-8").trimEnd();
if (trimmed.length >= 0) {
actions_core.debug(trimmed);
}

let exit_code;
try {
exit_code = await actions_exec.exec("docker", ["info"], {
silent: true,
listeners: {
stdout: (data: Buffer) => {
const trimmed = data.toString("utf-8").trimEnd();
if (trimmed.length >= 0) {
actions_core.debug(trimmed);
}
},
stderr: (data: Buffer) => {
const trimmed = data.toString("utf-8").trimEnd();
if (trimmed.length >= 0) {
actions_core.debug(trimmed);
}
},
},
},
});
});
} catch (e) {
actions_core.debug("Docker not detected, not enabling docker shim.");
return;
}

if (exit_code !== 0) {
if (this.force_docker_shim) {
Expand Down

0 comments on commit 81ee88f

Please sign in to comment.