Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support launching processes with inherited IO #241

Closed
fbricon opened this issue Nov 27, 2020 · 3 comments
Closed

Support launching processes with inherited IO #241

fbricon opened this issue Nov 27, 2020 · 3 comments
Milestone

Comments

@fbricon
Copy link

fbricon commented Nov 27, 2020

Create and unzip the simplest quarkus app possible. When running mvn quarkus:dev, the server logs are displayed following the maven traces:

❯ mvn quarkus:dev
executing mvnw instead of mvn
[INFO] Scanning for projects...
[INFO]
[INFO] -----------------------< org.acme:mvnd-quarkus >------------------------
[INFO] Building mvnd-quarkus 1.0.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- quarkus-maven-plugin:1.9.2.Final:dev (default-cli) @ mvnd-quarkus ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Nothing to compile - all classes are up to date
Listening for transport dt_socket at address: 5005


--/ __ / / / / _ | / _ / /// / / / __/
-/ /
/ / // / __ |/ , / ,< / // /\
--___
// |//|//||_//
2020-11-27 17:25:40,822 INFO [io.quarkus] (Quarkus Main Thread) mvnd-quarkus 1.0.0-SNAPSHOT on JVM (powered by Quarkus 1.9.2.Final) started in 0.559s.
2020-11-27 17:25:40,841 INFO [io.quarkus] (Quarkus Main Thread) Profile dev activated. Live Coding activated.
2020-11-27 17:25:40,841 INFO [io.quarkus] (Quarkus Main Thread) Installed features: [cdi]
hello commando
2020-11-27 17:25:40,874 INFO [io.quarkus] (Quarkus Main Thread) mvnd-quarkus stopped in 0.022s
Quarkus application exited with code 0
Press Enter to restart or Ctrl + C to quit
^C%

Now, using mvnd 0.1.1, with mvnd quarkus:dev -Dmvnd.noBuffering=true, the application logs are not shown (which is an issue for vscode-quarkus, since it can't detect the debugger is available):

❯ mvnd quarkus:dev -Dmvnd.noBuffering=true
[INFO] Scanning for projects...
[mvnd-quarkus] [INFO] BuildTimeEventSpy is registered.
[mvnd-quarkus] [INFO]
[mvnd-quarkus] [INFO] Using the SmartBuilder implementation with a thread count of 11
[mvnd-quarkus] [INFO] Task segments : [quarkus:dev]
[mvnd-quarkus] [INFO] Build maximum degree of concurrency is 11
[mvnd-quarkus] [INFO] Total number of projects is 1
[mvnd-quarkus] [INFO]
[mvnd-quarkus] [INFO] -----------------------< org.acme:mvnd-quarkus >------------------------
[mvnd-quarkus] [INFO] Building mvnd-quarkus 1.0.0-SNAPSHOT
[mvnd-quarkus] [INFO] --------------------------------[ jar ]---------------------------------
[mvnd-quarkus] [INFO]
[mvnd-quarkus] [INFO] --- quarkus-maven-plugin:1.9.2.Final:dev (default-cli) @ mvnd-quarkus ---
[mvnd-quarkus] [INFO] Using 'UTF-8' encoding to copy filtered resources.
[mvnd-quarkus] [INFO] Copying 1 resource
[mvnd-quarkus] [INFO] Nothing to compile - all classes are up to date

at that point, the server is actually running, but there's no clue from the output.

I suspect this will be a similar issue with other microservices or processes spawned from maven plugins

@gnodet
Copy link
Contributor

gnodet commented Nov 27, 2020

Yes, this is caused by the quarkus maven plugin spawning a process. It does use the inheritIO() on the ProcessBuilder, but mvnd does set specific system streams using System.setOut/Err(). Those can't be reused by spawned processes. I need to investigate if mvnd can go a bit deeper.

@gnodet
Copy link
Contributor

gnodet commented Nov 27, 2020

I see 2 solutions:

  • find a way to use dup2 using JNI so that the stream can be inherited, that does not seem really easy to do
  • change the maven quarkus plugin to not inherit the system output, but poll the output and print it to System.out instead

@gnodet
Copy link
Contributor

gnodet commented Nov 27, 2020

The first solution can't be done easily, so a change to quarkus maven plugin is the best solution imho.

@gnodet gnodet changed the title -Dmvnd.noBuffering=true doesn't show quarkus:dev output Support launching processes with inherited IO Jan 5, 2021
@gnodet gnodet closed this as completed in d6464ed Jan 6, 2021
@ppalaga ppalaga added this to the 0.3.0 milestone Jan 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants