[x] If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).
OS version and name: Ubuntu 20.04
When bad arguments are passed to poetry run, it is not immediately obvious what is wrong.
When no argument is provided, poetry run does not complain about the missing argument:
$poetry run
[FileNotFoundError]
[Errno 2] No such file or directory
Contrast with poetry new:
$poetry new
Not enough arguments (missing: "path").
Similarly, if given a flag, it might not be obvious that it is looking for an executable:
$poetry run --help
[FileNotFoundError]
[Errno 2] No such file or directory
In the current implementation, it appears that when poetry run is called without any additional parameter, run is passed as the only argument to the run command. Effectively, it is the same as poetry run run, which explains why you are seeing a "No such file or directory error.
I'm not sure why RunCommand implements a custom argument parser. If I remove RunCommand.__init__, the code seems to behave as one would expect. Running the single test test_run_passes_all_args seems to indicate there is custom logic that is necessary as otherwise the CLI parser considers poetry run python -V as similar to poetry -V and thus gets interrupted during the PRE_HANDLE step of the command dispatcher.
What I suggested seems to be what @sdispater did @ 65ba952f2db1ce400a3153575db7c5b42f398885, which was then reverted back @ 8fb4f4524dbe8603e7fd7bba390b2a7e72eb3ae9, so it appears to be a current limitation with clikit.