jagrosh / DiscordIPC

Connect locally to the Discord client using IPC for a subset of RPC features like Rich Presence and Activity Join/Spectate
Apache License 2.0
139 stars 46 forks source link

Error while closing the stream in IPCClient#close #14

Open iHDeveloper opened 5 years ago

iHDeveloper commented 5 years ago

Hello @jagrosh

I'm receiving this error while calling the function IPCClient#close which it should close everything safety but it appears an exception that I can't handle it by try and catch because it's in a different thread. So, I hope there's a solution for this error.

21:25:26.238 [Thread-11] ERROR com.jagrosh.discordipc.IPCClient - Reading thread encountered an IOException
java.io.IOException: Stream Closed
    at java.io.RandomAccessFile.length(Native Method)
    at com.jagrosh.discordipc.entities.pipe.WindowsPipe.read(WindowsPipe.java:56)
    at com.jagrosh.discordipc.IPCClient.lambda$startReading$0(IPCClient.java:350)
    at java.lang.Thread.run(Thread.java:748)
jagrosh commented 5 years ago

Marking this as a bug.

For now, since it's in a separate thread, then you can just ignore it (and if you don't want to see it at all, use your logging dependency to hide errors from IPCClient).

iHDeveloper commented 5 years ago

Well, Could we have a way to disable the error from the logger like setLogLevel. It will be useful to just let the IPCClient log whatever we want for having a useful log. 😄

jagrosh commented 5 years ago

IPCClient doesn't impose any particular logging dependency on you, it utilizes SLF4J, so you already can set the logging level to whatever you wish using your logging dependency

iHDeveloper commented 5 years ago

Thanks, @jagrosh for helping me. I appreciate it 😄