Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use soffice by default, fallback to libreoffice #139

Merged
merged 1 commit into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
2.3 (unreleased)
----------------

- Nothing changed yet.

- By default it will now use the `soffice`` executable instead of `libreoffice`,
as I had a problem with it using 100% load when started as `libreoffice`.

2.3b1 (2024-10-09)
------------------
Expand Down
19 changes: 16 additions & 3 deletions src/unoserver/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import argparse
import logging
import os
import shutil
import signal
import socket
import subprocess
Expand Down Expand Up @@ -252,8 +253,8 @@ def main():
parser.add_argument("--daemon", action="store_true", help="Deamonize the server")
parser.add_argument(
"--executable",
default="libreoffice",
help="The path to the LibreOffice executable",
default=None,
help="The path to the LibreOffice executable, defaults to looking in the path",
)
parser.add_argument(
"--user-installation",
Expand Down Expand Up @@ -292,10 +293,22 @@ def main():
user_installation,
)

if args.executable is not None:
executable = args.executable
else:
# Find the executable automatically. I had problems with
# LibreOffice using 100% if started with the libreoffice
# executable, so by default try soffice first. Also throwing
# ooffice in there as a fallback, I don't think it's used any
# more, but it doesn't hurt to have it there.
for name in ("soffice", "libreoffice", "ooffice"):
if (executable := shutil.which(name)) is not None:
break

# If it's daemonized, this returns the process.
# It returns 0 of getting killed in a normal way.
# Otherwise it returns 1 after the process exits.
process = server.start(executable=args.executable)
process = server.start(executable=executable)
if process is None:
return 2
pid = process.pid
Expand Down