diff --git a/src/main/java/ru/yandex/qatools/embed/postgresql/PostgresProcess.java b/src/main/java/ru/yandex/qatools/embed/postgresql/PostgresProcess.java index ad837d5..be5b0f2 100644 --- a/src/main/java/ru/yandex/qatools/embed/postgresql/PostgresProcess.java +++ b/src/main/java/ru/yandex/qatools/embed/postgresql/PostgresProcess.java @@ -241,28 +241,9 @@ protected void deleteTempFiles() { @Override protected final void onAfterProcessStart(ProcessControl process, IRuntimeConfig runtimeConfig) throws IOException { - final Storage storage = getConfig().storage(); - final Path pidFilePath = Paths.get(storage.dbDir().getAbsolutePath(), "postmaster.pid"); - final File pidFile = new File(pidFilePath.toAbsolutePath().toString()); - int timeout = TIMEOUT; - while (!pidFile.exists() && ((timeout = timeout - 100) > 0)) { - try { - sleep(100); - } catch (InterruptedException ie) { /* safe to ignore */ } - } - int pid = -1; - try { - pid = Integer.valueOf(readLines(pidFilePath.toFile()).get(0)); - } catch (Exception e) { - LOGGER.error("Failed to read PID file ({})", e.getMessage(), e); - } - if (pid != -1) { - setProcessId(pid); - } else { - // fallback, try to read pid file. will throw IOException if that fails - setProcessId(getPidFromFile(pidFile())); - } - + final Storage storage = getConfig().storage(); + setProcessId(process.getPid()); + int trial = 0; do { String output = runCmd(getConfig(), diff --git a/src/main/java/ru/yandex/qatools/embed/postgresql/PostgresStarter.java b/src/main/java/ru/yandex/qatools/embed/postgresql/PostgresStarter.java index d0354fb..fb0c3a8 100644 --- a/src/main/java/ru/yandex/qatools/embed/postgresql/PostgresStarter.java +++ b/src/main/java/ru/yandex/qatools/embed/postgresql/PostgresStarter.java @@ -52,7 +52,7 @@ public static IRuntimeConfig runtimeConfig(Command cmd) { public static , P extends AbstractPGProcess> PostgresStarter getCommand(Command command, IRuntimeConfig config) { - return new PostgresStarter<>(command.executableClass(), config); + return new PostgresStarter(command.executableClass(), config); } public static , P extends AbstractPGProcess>