-
Notifications
You must be signed in to change notification settings - Fork 15
mxcli init copies Windows binary into project, making devcontainer unusable on Windows #91
Description
mxcli init copies Windows binary into project, making devcontainer unusable on Windows
Summary
When running mxcli init on Windows, the tool copies the currently running Windows executable (mxcli.exe) into the project root. The generated devcontainer is a Linux environment, so the copied binary is a PE (Windows) executable that cannot run inside the container. The result is that the devcontainer starts up but mxcli is silently non-functional, with no error or warning produced during init to indicate that this has happened.
Environment
- OS: Windows (tested on Windows 11)
- mxcli installed as a native Windows binary
- Devcontainer runtime: Docker Desktop with WSL2 backend
- VS Code with Dev Containers extension
Steps to reproduce
- Install the Windows release of mxcli from the releases page.
- Run
mxcli init /path/to/my-mendix-project. - Open the project folder in VS Code and reopen in the Dev Container.
- Inside the container, attempt to run
./mxcli --version.
Expected behaviour
mxcli init should place a working mxcli binary in the project root that is executable inside the Linux devcontainer.
Actual behaviour
The binary placed in the project root is the Windows PE executable. Inside the Linux container it either fails to execute with a format error or produces no output at all. The init command gives no warning that the copied binary is incompatible with the container's OS.
Root cause
mxcli init uses os.Executable() (or equivalent) to locate the currently running binary and copies it verbatim into the project root. On Windows, this is a PE-format .exe file. The devcontainer is Linux-based and cannot execute PE binaries, so the copy is immediately unusable.
Workaround
Manually download the correct Linux binary from the releases page and place it in the project root before opening the devcontainer:
curl -L https://github.com/mendixlabs/mxcli/releases/latest/download/mxcli-linux-amd64 -o mxcli
chmod +x mxcliSuggested fix
During mxcli init, detect when the host OS is Windows and instead of copying the local binary, either:
- Download the Linux binary automatically from the releases page (matching the current version) and write that to the project root instead. This is the most seamless option for users.
- Emit a clear warning explaining that the copied binary will not work inside the devcontainer on Windows, and print the curl command needed to get the correct binary. This is the lighter-weight option if automatic downloading is undesirable.
Option 1 could use the GitHub releases API to resolve the correct download URL based on mxcli --version, ensuring the binary in the project always matches the version that generated the config files.
References
This issue is documented in a real-world walkthrough here: https://medium.com/@MohamedElNady27/i-let-an-ai-build-a-full-mendix-app-from-scratch-heres-what-happened-08511dd660b1