quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.84k stars 2.7k forks source link

quarkus echo with bash not working #40889

Open maxandersen opened 5 months ago

maxandersen commented 5 months ago

Describe the bug

cannot create shell script to use with quarkus cli:

echo echo \$\* > quarkus-echo
❯ chmod +x quarkus-echo
❯ quarkus echo test
java.io.IOException: Cannot run program "quarkus-echo" (in directory "/Users/manderse/code/jcon/jconqbot"): error=2, No such file or directory
    at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1170)
    at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1089)
    at io.quarkus.cli.build.ExecuteUtil.executeProcess(ExecuteUtil.java:72)
    at io.quarkus.cli.plugin.PluginCommand.call(PluginCommand.java:31)
    at io.quarkus.cli.plugin.PluginCommand.call(PluginCommand.java:12)
    at picocli.CommandLine.executeUserObject(CommandLine.java:2041)
    at picocli.CommandLine.access$1500(CommandLine.java:148)
    at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2461)
    at picocli.CommandLine$RunLast.handle(CommandLine.java:2453)
    at picocli.CommandLine$RunLast.handle(CommandLine.java:2415)
    at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2273)
    at picocli.CommandLine$RunLast.execute(CommandLine.java:2417)
    at picocli.CommandLine.execute(CommandLine.java:2170)
    at io.quarkus.cli.QuarkusCli.run(QuarkusCli.java:149)
    at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:132)
    at io.quarkus.runtime.Quarkus.run(Quarkus.java:71)
    at io.quarkus.runtime.Quarkus.run(Quarkus.java:44)
    at io.quarkus.cli.Main.main(Main.java:9)
Caused by: java.io.IOException: error=2, No such file or directory
    at java.base/java.lang.ProcessImpl.forkAndExec(Native Method)
    at java.base/java.lang.ProcessImpl.<init>(ProcessImpl.java:295)
    at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:225)
    at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1126)
    ... 17 more
[ERROR] ❗  Unable to run plugin command: [quarkus-echo] with arguments: [test]

Expected behavior

No response

Actual behavior

No response

How to Reproduce?

No response

Output of uname -a or ver

No response

Output of java -version

No response

Quarkus version or git rev

No response

Build tool (ie. output of mvnw --version or gradlew --version)

No response

Additional information

No response

The-Funk commented 5 months ago

@maxandersen I noticed that your path is /Users/manderse/code/jcon/jconqbot, and not /home/manderse....

Are you developing on Windows but attempting to run this script in WSL?

What happens if you install dos2unix in WSL and then run it against the script prior to executing the script?

maxandersen commented 5 months ago

this is on OSX - no windows allowed.

I think what goes wrong is that quarkus echo is looking in the PATH for quarkus-echo but fails to find it...

but whats funky is that if you don't chmod +x it does not fail same way.

So i think there is some inconsistency in how lookups are done.

iocanel commented 2 months ago

@maxandersen: Unless the script is available in the path, its not expected to work. So, I would expect a step where you copy the script in your PATH. If you add this step everything works as expected.

What I find odd but can't reproduce is how the script is recognized as plugin in the first place.