@@ -19,7 +19,7 @@ public class DBusFileMangerRevealPath implements RevealPathService {
19
19
20
20
private static final String FOR_FOLDERS = "org.freedesktop.FileManager1.ShowFolders" ;
21
21
private static final String FOR_FILES = "org.freedesktop.FileManager1.ShowItems" ;
22
- private static final int TIMEOUT_THRESHOLD = 5000 ;
22
+ private static final int TIMEOUT_THRESHOLD = 5000 ;
23
23
24
24
@ Override
25
25
public void reveal (Path path ) throws RevealFailedException {
@@ -28,7 +28,7 @@ public void reveal(Path path) throws RevealFailedException {
28
28
var uriPath = Arrays .stream (path .toUri ().getPath ().split ("/" )).map (s -> URLEncoder .encode (s , StandardCharsets .UTF_8 ).replace ("+" , "%20" )).collect (Collectors .joining ("/" ));
29
29
ProcessBuilder pb = new ProcessBuilder ().command ("dbus-send" ,
30
30
"--print-reply" ,
31
- "--reply-timeout=" + TIMEOUT_THRESHOLD ,
31
+ "--reply-timeout=" + TIMEOUT_THRESHOLD ,
32
32
"--dest=org.freedesktop.FileManager1" ,
33
33
"--type=method_call" ,
34
34
"/org/freedesktop/FileManager1" ,
@@ -37,10 +37,13 @@ public void reveal(Path path) throws RevealFailedException {
37
37
"string:\" \" "
38
38
);
39
39
var process = pb .start ();
40
- if (process .waitFor (TIMEOUT_THRESHOLD , TimeUnit .MILLISECONDS )) {
41
- int exitValue = process .exitValue ();
42
- if (exitValue != 0 ) {
43
- throw new RevealFailedException ("dbus-send returned with code" + exitValue );
40
+ try (var reader = process .errorReader ()) {
41
+ if (process .waitFor (TIMEOUT_THRESHOLD , TimeUnit .MILLISECONDS )) {
42
+ int exitValue = process .exitValue ();
43
+ if (process .exitValue () != 0 ) {
44
+ String error = reader .lines ().collect (Collectors .joining ());
45
+ throw new RevealFailedException ("dbus-send exited with code " + exitValue + " and error message: " + error );
46
+ }
44
47
}
45
48
}
46
49
} catch (IOException e ) {
0 commit comments