File tree Expand file tree Collapse file tree 1 file changed +9
-16
lines changed
src/main/java/io/github/berstanio/pymobiledevice3/daemon Expand file tree Collapse file tree 1 file changed +9
-16
lines changed Original file line number Diff line number Diff line change @@ -97,24 +97,17 @@ public static void startDaemon(PyInstallation installation) throws IOException {
9797 pb .redirectOutput (getLogFile ());
9898 pb .start ();
9999
100- try (WatchService watchService = FileSystems .getDefault ().newWatchService ()){
101- portFile .toPath ().getParent ().register (watchService , StandardWatchEventKinds .ENTRY_MODIFY );
102- while (true ) {
103- WatchKey key = watchService .take ();
104- for (WatchEvent <?> event : key .pollEvents ()) {
105- WatchEvent .Kind <?> kind = event .kind ();
106- if (kind != StandardWatchEventKinds .ENTRY_MODIFY )
107- continue ;
108- Path modifiedFile = (Path ) event .context ();
109- if (!modifiedFile .toString ().equals (portFile .getName ()))
110- continue ;
111- if (getDaemonPort () != -1 )
112- return ;
113- }
100+ for (int i = 0 ; i < 60 ; i ++) {
101+ if (isDaemonRunning ()) {
102+ return ;
103+ }
104+ try {
105+ Thread .sleep (1000 );
106+ } catch (InterruptedException e ) {
107+ throw new RuntimeException (e );
114108 }
115- } catch (InterruptedException e ) {
116- throw new RuntimeException (e );
117109 }
110+ throw new RuntimeException ("Failed to start Daemon - timeout" );
118111 }
119112
120113 private static String getUnixUserId () {
You can’t perform that action at this time.
0 commit comments