Skip to content

Commit

Permalink
Add constant for connection refused code in docker.js
Browse files Browse the repository at this point in the history
  • Loading branch information
truemiller committed Feb 21, 2024
1 parent 05a00b2 commit 495f354
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion electron/docker.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
const Docker = require("dockerode");

const connectionRefusedCode = "ECONNREFUSED";

const docker = new Docker(
process.platform === "win32"
? { socketPath: "//./pipe/docker_engine" }
Expand All @@ -10,7 +12,7 @@ function isDockerRunning() {
return new Promise((resolve, reject) => {
docker.ping((err) => {
if (err) {
if (err.code === "ECONNREFUSED") {
if (err.code === connectionRefusedCode) {
resolve(false); // Docker is not running
} else {
reject(err); // Error other than connection refused
Expand Down

0 comments on commit 495f354

Please sign in to comment.