Skip to content

Commit

Permalink
Made the --daemon argument work again
Browse files Browse the repository at this point in the history
  • Loading branch information
Lennart Regebro authored and regebro committed Oct 16, 2023
1 parent 622ddd0 commit 2434d66
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
2.0b2 (unreleased)
------------------

- Nothing changed yet.
- Made the --daemon parameter work again


2.0b1 (2023-08-18)
Expand Down
10 changes: 7 additions & 3 deletions src/unoserver/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import os
import signal
import subprocess
import sys
import tempfile
import threading
import platform
Expand Down Expand Up @@ -189,6 +190,12 @@ def main():
)
args = parser.parse_args()

if args.daemon:
cmd = sys.argv
cmd.remove("--daemon")
proc = subprocess.Popen(cmd)
return proc.pid

with tempfile.TemporaryDirectory() as tmpuserdir:
user_installation = Path(tmpuserdir).as_uri()

Expand Down Expand Up @@ -220,9 +227,6 @@ def main():
with open(args.libreoffice_pid_file, "wt") as upf:
upf.write(f"{pid}")

if args.daemon:
return os.getpid()

process.wait()

if args.libreoffice_pid_file:
Expand Down
4 changes: 2 additions & 2 deletions tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ def test_convert_not_local():

with open(outfile.name, "rb") as testfile:
start = testfile.readline()
assert start == b"%PDF-1.5\n" or start == b"%PDF-1.6\n"
assert start.startswith(b"%PDF-1.")

finally:
# Now kill the process
Expand Down Expand Up @@ -251,7 +251,7 @@ def test_compare_not_local():

with open(outfile.name, "rb") as testfile:
start = testfile.readline()
assert start == b"%PDF-1.5\n" or start == b"%PDF-1.6\n"
assert start.startswith(b"%PDF-1.")

finally:
# Now kill the process
Expand Down

0 comments on commit 2434d66

Please sign in to comment.