From b0330c9fcd7d11105c85277e30c36881df81cc05 Mon Sep 17 00:00:00 2001 From: Kasper de Graaff Date: Thu, 9 Jul 2026 14:32:58 +0200 Subject: [PATCH] fix(init): make devcontainer postCreateCommand robust on Podman-on-Windows The devcontainer template generated by `mxcli init`/`new` had two bugs that failed `postCreateCommand` (red error in VS Code) when the workspace is a 9p bind-mount from a Windows drive under Podman: 1. `file` was never installed in the image, so `file ./mxcli | grep -q Linux` emitted `command not found` and the Linux-binary fast-path was never taken (always re-downloaded). Add `file` to the Dockerfile apt list. 2. The download fallback ran an unguarded `chmod +x ./mxcli`, which fails with `Operation not permitted` on 9p (Unix perm changes disallowed) and failed the whole postCreate even though the binary is already executable. Guard it with `2>/dev/null || true`. Fixes #742 Co-Authored-By: Claude Opus 4.8 (1M context) --- cmd/mxcli/tool_templates.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/mxcli/tool_templates.go b/cmd/mxcli/tool_templates.go index ea845d67d..67dd6ec45 100644 --- a/cmd/mxcli/tool_templates.go +++ b/cmd/mxcli/tool_templates.go @@ -312,7 +312,7 @@ func generateDevcontainerJSON(projectName, mprPath, containerRuntime string) str "containerEnv": { %s }, - "postCreateCommand": "curl -fsSL https://claude.ai/install.sh | bash && if [ -f ./mxcli ] && file ./mxcli | grep -q Linux; then echo 'mxcli binary OK'; else ./mxcli setup mxcli --output ./mxcli 2>/dev/null || { ARCH=$(uname -m); [ \"$ARCH\" = x86_64 ] && ARCH=amd64; [ \"$ARCH\" = aarch64 ] && ARCH=arm64; curl -fsSL https://github.com/mendixlabs/mxcli/releases/latest/download/mxcli-linux-${ARCH} -o ./mxcli && chmod +x ./mxcli; }; fi", + "postCreateCommand": "curl -fsSL https://claude.ai/install.sh | bash && if [ -f ./mxcli ] && file ./mxcli | grep -q Linux; then echo 'mxcli binary OK'; else ./mxcli setup mxcli --output ./mxcli 2>/dev/null || { ARCH=$(uname -m); [ \"$ARCH\" = x86_64 ] && ARCH=amd64; [ \"$ARCH\" = aarch64 ] && ARCH=arm64; curl -fsSL https://github.com/mendixlabs/mxcli/releases/latest/download/mxcli-linux-${ARCH} -o ./mxcli && { chmod +x ./mxcli 2>/dev/null || true; }; }; fi", "customizations": { "vscode": { "extensions": [ @@ -362,6 +362,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends wget apt-transp temurin-21-jdk \ nodejs \ postgresql-client \ + file \ kafkacat \ && apt-get clean \ && rm -rf /var/lib/apt/lists/*