childprocess-vertx-ext icon indicating copy to clipboard operation
childprocess-vertx-ext copied to clipboard

IllegalStateException

Open wbasterfield opened this issue 6 years ago • 3 comments

Hi there

Busy testing your library and I'm getting an IllegalStateException.

Here is the test code

public static void main(String[] args) { Vertx v = Vertx.vertx(); Process process = Process.spawn(v, "ls"); process.stdout().handler(buff -> { System.out.println("STD "+buff.toString()); }); process.stderr().handler(buff -> { System.out.println("Error "+ buff.toString()); }); process.exitHandler(code -> { System.out.println("Child process exited with code: " + code); v.close(); }); process.start(); /* try { process.start(); }catch(Exception ex) {}*/ }

Here is the exception

Exception in thread "main" java.lang.IllegalStateException at com.julienviet.childprocess.impl.ProcessImpl.start(ProcessImpl.java:72) at com.julienviet.childprocess.impl.ProcessImpl.start(ProcessImpl.java:66) at ztest.start.main(start.java:24)

Everything does what its supposed to do so thats all good, we get the directory listing and exit no problems, so I'm not sure why the start method is generating an exception.

wbasterfield avatar Dec 18 '17 10:12 wbasterfield

it's because the start method is called two times

vietj avatar Dec 18 '17 10:12 vietj

The second start method is commented out

wbasterfield avatar Dec 18 '17 12:12 wbasterfield

can you provide a reproducer for the case ?

vietj avatar Dec 18 '17 12:12 vietj