judovana / java-runtime-decompiler

GNU General Public License v3.0
68 stars 14 forks source link

javap exec is missuning shared stderr/out #189

Closed judovana closed 2 years ago

judovana commented 2 years ago

The redirected stdout and err, to capture current stds and then stop capturig them is pure evil. Any subprocess, which stdout/err we are interested in, should have its own thread-based std readers. I think my AbstractSourceTestClass.java can be refactored, so its base class is just launched process with stderr/out captured. And then launch javap via that.

judovana commented 2 years ago

ok it does not. Was still sleeping.

But the

      while ((line = reader.readLine()) != null) {
                sb.append(line).append(System.getProperty("line.separator", "\n"));
                javap.waitFor(2, TimeUnit.SECONDS);
            }
        }

        javap.destroy();

is terrible

please replace destroy by waitfor, and remove waitfor from the loop!

judovana commented 2 years ago

I think the timeout will be redundat then