https://bugs.documentfoundation.org/show_bug.cgi?id=163863

--- Comment #8 from yarma22 <[email protected]> ---
Good call about the PID!

So indeed, I'm able to generate all the files when I execute the conversion
command interactively after starting the process in the background.

I think I have a clue of what goes wrong when applying this workaround to the
script: actually, when running the conversion interactively, the background
process doesn't necessarily stop right away after the conversion is over, e.g.:
```
$ soffice --headless > /dev/null &
[1] 2611881
$ soffice --headless --convert-to pdf --outdir PDF *.odt
$ 
[1]+  Done                    soffice --headless > /dev/null
$ soffice --headless > /dev/null &
[1] 2612077
$ soffice --headless --convert-to pdf --outdir PDF *.odt
$ 
[1]+  Done                    soffice --headless > /dev/null
```

In the script, the conversions of some folders fail while some others are
successful. Basically:
```
generate_pdfs() {
  src_dir="$1"
  dest_dir="$2"

  echo "Converting $1..."
  soffice --headless > /dev/null
  # No need to ditch the output since it's the background process that takes
care of the output
  soffice --headless --convert-to pdf --outdir "$dest_dir" "$src_dir"/*.odt
  kill "$pid"
  echo "Done."
}
```
and then:
```
$ bash odt2pdf.sh
Converting dir1...
Done.
Converting dir2...
convert dir2/file001.odt as a Writer document -> dir2/PDF/file001.pdf using
filter : writer_pdf_Export
convert dir2/file002.odt as a Writer document -> dir2/PDF/file002.pdf using
filter : writer_pdf_Export
... # -> Bunch more lines until the conversion silently fails before reaching
the end of the folder
Done.
Converting dir3...
Done.
Converting dir4...
Done.
Converting dir5...
convert dir5/file001.odt as a Writer document -> dir5/PDF/file001.pdf using
filter : writer_pdf_Export
convert dir5/file002.odt as a Writer document -> dir5/PDF/file002.pdf using
filter : writer_pdf_Export
...
Done.
```

Conversion for folders dir2 and dir5 were unsuccessful. Note that which folders
fail is quite random (it could be 2 and 4 or 2, 3 and 5 or 2, 4 and 5, etc.),
but at least it seems that the first folder always goes through and that the
second one always fails.

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to