Skip to content

Commit c0f3c0e

Browse files
authored
Merge pull request #241 from dgageot/fix-darwin
Fix darwin
2 parents b2ec939 + 57a93a4 commit c0f3c0e

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/extension/ui/src/utils/Files.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,19 @@
55
import { v1 } from "@docker/extension-api-client-types";
66
import { ExecResult } from "@docker/extension-api-client-types/dist/v0";
77
import { encode } from "js-base64";
8-
98
import { BUSYBOX } from "../Constants";
109

1110
export const tryRunImageSync = async (
1211
client: v1.DockerDesktopClient,
1312
args: string[],
1413
ignoreError = false
1514
) => {
16-
const showError = ignoreError ? () => {} : client.desktopUI.toast.error;
15+
const showError = ignoreError ? () => { } : client.desktopUI.toast.error;
1716
try {
1817
const result = await client.docker.cli.exec("run", args);
19-
if (result.code !== undefined && result.code != 0 && result.stderr) {
18+
if (result.stderr && result.stderr.includes("shell operators are not allowed")) {
19+
// This shouldn't happen: it means we have our escaping wrong.
20+
// And there's no way to check that failure other than by looking at stderr's content...
2021
showError(result.stderr);
2122
}
2223
return result.stdout || "";
@@ -82,7 +83,7 @@ export const writeToPromptsVolume = async (
8283
BUSYBOX,
8384
"/bin/sh",
8485
"-c",
85-
`\\"echo ${encode(content)} | base64 -d > ${filename}\\"`,
86+
`'echo ${encode(content)} | base64 -d > ${filename}'`,
8687
]);
8788
};
8889

@@ -99,6 +100,6 @@ export const writeToMount = async (
99100
BUSYBOX,
100101
"/bin/sh",
101102
"-c",
102-
`\\"echo ${encode(content)} | base64 -d > ${filename}\\"`,
103+
`'echo ${encode(content)} | base64 -d > ${filename}'`,
103104
]);
104105
};

0 commit comments

Comments
 (0)