1111import java .nio .file .Path ;
1212import java .nio .file .attribute .BasicFileAttributes ;
1313import java .util .Arrays ;
14- import java .util .concurrent .CountDownLatch ;
1514import java .util .concurrent .TimeUnit ;
1615import java .util .stream .Collectors ;
1716
@@ -60,20 +59,10 @@ public void reveal(Path path) throws RevealFailedException {
6059
6160 @ Override
6261 public boolean isSupported () {
63- CountDownLatch waitBarrier = new CountDownLatch (2 );
64- ProcessBuilder dbusSendExistsBuilder = new ProcessBuilder ().command ("test" , " `command -v dbus-send`" );
65- ProcessBuilder fileManager1ExistsBuilder = createFileManager1Check ();
66-
6762 try {
68- var dbusSendExists = dbusSendExistsBuilder .start ();
69- dbusSendExists .onExit ().thenRun (waitBarrier ::countDown );
70- var fileManager1Exists = fileManager1ExistsBuilder .start ();
71- fileManager1Exists .onExit ().thenRun (waitBarrier ::countDown );
72-
73- if (waitBarrier .await (TIMEOUT_THRESHOLD , TimeUnit .MILLISECONDS )) {
74- if (dbusSendExists .exitValue () == 0 && fileManager1Exists .exitValue () == 0 ) {
75- return parseOutputForFileManagerInterface (fileManager1Exists );
76- }
63+ var fileManager1Exists = createFileManager1Check ().start ();
64+ if (fileManager1Exists .waitFor (TIMEOUT_THRESHOLD , TimeUnit .MILLISECONDS ) && fileManager1Exists .exitValue () == 0 ) {
65+ return parseOutputForFileManagerInterface (fileManager1Exists );
7766 }
7867 } catch (IOException | InterruptedException e ) {
7968 //NO-OP
@@ -90,7 +79,7 @@ public boolean isSupported() {
9079 * @throws IOException if the Inputer reader on the process output cannot be created
9180 */
9281 private boolean parseOutputForFileManagerInterface (Process fileManager1Process ) throws IOException {
93- if ( fileManager1Process .isAlive ()) {
82+ if ( fileManager1Process .isAlive ()) {
9483 throw new IllegalArgumentException ("Process " + fileManager1Process + " must be terminated to read output." );
9584 }
9685 try (var reader = fileManager1Process .inputReader (StandardCharsets .UTF_8 )) {
0 commit comments