postgresql-embedded icon indicating copy to clipboard operation
postgresql-embedded copied to clipboard

Add possiblity to check an error (exit code) of a postgres process command

Open oilid opened this issue 8 years ago • 0 comments

Currently it's not possible to check an error (exit code) of a postgres process command. The problem ist the code in PostgresProcess.runCmd returns a String returned by "logWatch.getOutput()". But the best option would be to return the value of "proc.waitFor()" which give us the exit code of the process. By convention, 0 indicates normal termination. Im my concrete case I needed this exit code for the method PostgresProcess.restoreFromFile to know if a database import was successful. So in my opinion at least the following methods:

  • PostgresProcess.importFromFile
  • PostgresProcess.importFromFileWithArgs
  • PostgresProcess.restoreFromFile
  • PostgresProcess.exportToFile
  • PostgresProcess.exportSchemeToFile
  • PostgresProcess.exportDataToFile

should return the exitCode of the changed method "PostgresProcess.runCmd".

I just realized this issue in my fork (backport java 1.6): oilid/postgresql-embedded@22e649d

oilid avatar Nov 14 '17 15:11 oilid