devcontainer exec attempts confuses args depending on order
When running devcontainer exec --workspace-folder . ls everything works as expected.
When running devcontainer --workspace-folder . exec ls the devcontainer CLI attempts to run exec in the container. It confuses the args and interprets exec as cmd.
Am I correct in assuming that devcontainer --workspace-folder . exec should be a valid way to invoke exec?
Hi 👋
Am I correct in assuming that devcontainer --workspace-folder . exec should be a valid way to invoke exec?
I don't think that the @devcontainers/cli is configured to be used in ^ way, and that's the reason why it's currently failing.
The @devcontainers/cli expects it to be used as devcontainer <command> [optional args]. See 👇
Am I correct in assuming that devcontainer --workspace-folder . exec should be a valid way to invoke exec?
Curious, @csweichel is there a specific reason/interest in expecting it ^ to work in such a way? We can definitely update the CLI based on community interest/feedback, but doesn't seem like this is planned for now.
Curious, @csweichel is there a specific reason/interest in expecting it ^ to work in such a way? We can definitely update the CLI based on community interest/feedback, but doesn't seem like this is planned for now.
Largely past experience with other CLIs where more often than not the order of flags and args does not matter all that much, the occasional ordering of global/command-specific flags notwithstanding.
That said, I'd have expected the CLI to fail with a definite error message when used "incorrectly", rather than it trying to execute something. I was surprised because it seemed like it was working, just not correctly.
--workspace-folder is needed for most of the subcommands here, and I have been tempted to use a shell alias or wrapper function to provide it automatically. The most obvious way to do that is
alias devcontainer='\devcontainer --workspace-folder=$PROJECT_DIR'
In any event, I think this should generate a clear error and not for devcontainer to try to execute a command named exec in the dev container.
:; devcontainer --workspace-folder=. exec id
OCI runtime exec failed: exec failed: unable to start container process: exec: "exec": executable file not found in $PATH: unknown