private void startupProcess(boolean restart) throws IOException { if (myIsShuttingDown) { return; } if (ShutDownTracker.isShutdownHookRunning()) { myIsShuttingDown = true; return; } if (myStartAttemptCount++ > MAX_PROCESS_LAUNCH_ATTEMPT_COUNT) { notifyOnFailure(ApplicationBundle.message("watcher.failed.to.start"), null); return; } if (restart) { shutdownProcess(); } LOG.info("Starting file watcher: " + myExecutable); ProcessBuilder processBuilder = new ProcessBuilder(myExecutable.getAbsolutePath()); Process process = processBuilder.start(); myProcessHandler = new MyProcessHandler(process); myProcessHandler.addProcessListener(new MyProcessAdapter()); myProcessHandler.startNotify(); if (restart) { List<String> recursive = myRecursiveWatchRoots; List<String> flat = myFlatWatchRoots; if (recursive.size() + flat.size() > 0) { setWatchRoots(recursive, flat, true); } } }