Hi, I'm using LibreOffice 6.3.3.2 a64200df03143b798afd1ec74a12ab50359878ed on Win10. The --cat option of soffice.exe doesn't output the text contents of the files included on the command line as described. > --cat Dump text content of the following files to console For example command below doesn't output the text of any of ODT files I've tried the command with to the console as expected. "%ProgramFiles%\LibreOffice\program\soffice.exe" --cat "any-odt-file.odt"
What happens if you use soffice.com instead of soffice.exe ?
I get the exact same behavior with soffice.com
Could you please attach a sample ODT file you tried with, and also a screenshot of the command and (missing) result? Thanks.
Created attachment 156902 [details] SS of command output. Attached is the SS of command output.
Created attachment 156903 [details] Sample ODT file that doesn't --cat output
Attached are the requested SS of the command output and the sample ODT file used.
(In reply to Brad from comment #6) Thanks! 1. As mentioned in comment 1, the command like should start with > "C:\Program Files\LibreOffice\program\soffice.com" or simply > "C:\Program Files\LibreOffice\program\soffice" That is because .com is console-mode application; .exe is GUI application. 2. When you have another LibreOffice instance running, all following LibreOffice instances don't do anything themselves, but just pass their command to the first running instance. That means, in thi case, that the other program will receive the --cat command - and try to output the result to (absent) console; while this console will not receive anything. Possibly there should be passing of the --cat and the like back to the caller ... Anyway, please test without other LibreOffice instances running (including quickstart if enabled).
Using the com command ("C:\Program Files\LibreOffice\program\soffice.com" --cat test-cat.odt) without any LibreOffice instances running does produce the output expected. However there is no output when there is any instance running due to the reasons you mention in part 2. Is there anyway to use this command with an instance running without a bit of programming? I would argue that it's a big limitation and makes the commands usefulness questionable. I would like to use the command for git revisions so it would be necessary for the command to still work on open documents. Thanks for your time!
(In reply to Brad from comment #8) > Is there anyway to use this command with an instance running without a bit > of programming? Yes: you may use a different (e.g., temporary) user profile [1] for the task, and that would create a separate process which will not offload its task to the already running instance: see -env:UserInstallation sample in help [2]. Note that, although you may use empty temp directory each time for the task, it will create significant overhead because of the need to initialize new profile; so better create a dedicated profile once, and then reuse it. > I would argue that it's a big limitation and makes the > commands usefulness questionable. ... which is why I didn't close it - see first sentence of last paragraph of comment 7. [1] https://wiki.documentfoundation.org/UserProfile [2] https://help.libreoffice.org/latest/en-US/text/shared/guide/start_parameters.html
(In reply to Mike Kaganski from comment #7) > Possibly there should be passing of the --cat and the like back to the > caller Yes, that's apparently missing in <https://gerrit.libreoffice.org/plugins/gitiles/core/+/3d318e6cf4a183e14a043840b9990958c7527536%5E!/> "fdo#70625 Add --cat parameter to make git diffs pretty".
WORKAROUNDS Either use another tool like: odt2txt unoconv --format=txt --stdout Or for your Git config (for diffing ODF files): [diff "odf"] textconv = "bash -c 'td=\"$(mktemp -d)/\"; loffice --convert-to txt --outdir \"${td}\" \"${0}\" || true; cat \"${td}\"*; rm -Iv \"${td}\"*; rmdir -v \"${td}\"'" # NOTE: The -I for rm is important for safety reasons. DONT REMOVE THE -I!!!
Fix is tracked in https://gerrit.libreoffice.org/c/core/+/154909
Matt K committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/efae7b4a1f7248b01e8cd95577c09d772cfe5709 tdf#129713 Output message when using "--cat" with other LO instances running It will be available in 24.2.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
(In reply to Commit Notification from comment #13) > Matt K committed a patch related to this issue. This patch just adds an error message so people can see why --cat fails if another LO instance is running. Resetting to NEW for anyone who wants to try to handle dumping cat content to console via the IPC pipe. Either the console has to be shared somehow, or the text content has to be marshalled back to the pipe somehow, it seems, which looks like a non-trivial amount of work.