Menu

#11 Exit Codes Ignored

v1.0 (example)
closed
nobody
None
5
2016-01-16
2016-01-05
kaihowl
No

Is there a particular reason why the exit code of Sys.command is ignored in the definition of "run"? This leads to the ugliness that "convert" can be killed in an out of memory situation without pdfsandwich taking any notice of that. Pdfsandwich will exit with code 0 and an incomplete, but not corrupted pdf file.

Let me know if you need a pull request. This would give me the chance to learn some OCAML. :P

Discussion

  • Tobias Elze

    Tobias Elze - 2016-01-05

    Thanks for the notice. This should be fixed now. Would you like to check?

    Thanks,
    Tobias

     
  • kaihowl

    kaihowl - 2016-01-09

    Thank you for so quickly looking into this. The thread correctly terminates when the called program does not exit cleanly. It already did this before with an exception instead of a nice message. In the end, the main program still exits with code zero, though.

    I would guess that somewhere in l. 231 a check for the exit condition of the thread is required. Or just having a global variable "error_occurred", which is set to True once an exception occurs in a thread, combined with a final check before setting the exit code would be enough to fix this. What do you think?

    See current output below.

    Best,

    Kai.

    pdfsandwich version 0.1.4
    Input file: "/root/test.pdf"
    Output file: "/root/test_ocr.pdf"
    Number of pages in inputfile: 10
    Processing page 1.
    identify -format "%w\n%h\n"  "/root/test.pdf[0]"
    Terminated
    Thread 1 killed on uncaught exception Failure("Command "convert  -type Bilevel  -density 300x300 "/root/test.pdf[0]" /tmp/pdfsandwich719369.pbm" failed.
    ")
    OCR done. Writing "/root/test_ocr.pdf"
    
    Done.
      src  echo $?
    0
    
     
  • Tobias Elze

    Tobias Elze - 2016-01-10

    Oh, sorry, I didn't realize that. I fixed it now (I hope). Feel free to check and to give me feedback.

    Tobias

     
  • kaihowl

    kaihowl - 2016-01-16

    Fixed. Thank you very much and sorry for the delay in checking.

     
  • Tobias Elze

    Tobias Elze - 2016-01-16
    • status: open --> closed
     

Log in to post a comment.

MongoDB Logo MongoDB