Calling GnuPG in Java via a Runtime Process to encrypt and decrypt files - Decrypt always hangs

前端 未结 7 1454
隐瞒了意图╮
隐瞒了意图╮ 2021-01-18 16:25

NOTE: Coming back to this later as I\'ve been unable to find a working solution. Draining the input streams manually instead of using BufferedReaders doesn

相关标签:
7条回答
  • I stumbled upon this thread today because I was having the exact same issue as far as the program hanging. Cameron's thread from above contains the solution, which is that you have to be draining the inputStream from your process. If you don't, the stream fills up and hangs. Simply adding

    String line = null;
    while ( (line = gpgOutput.readLine()) != null ) {
         System.out.println(line);
    }
    

    Before checking the exitValue fixed it for me.

    0 讨论(0)
提交回复
热议问题