[Solved] Terminating an office instance cleanly
Posted: Sat Feb 14, 2015 10:13 pm
I've created a new office instance:
and then connected to it do do some work:
Now my question is: How do I shut down the whole process cleanly, so that I won't get the "Document recovery" dialog next time around I open office. For now I have something like this:
Code: Select all
soffice --accept="socket,host=localhost,port=2002;urp;StarOffice.ServiceManager"Code: Select all
local = uno.getComponentContext()
resolver = local.ServiceManager.createInstanceWithContext("com.sun.star.bridge.UnoUrlResolver", local)
context = resolver.resolve("uno:socket,host=localhost,port=2002;urp;StarOffice.ComponentContext")
desktop = context.ServiceManager.createInstanceWithContext("com.sun.star.frame.Desktop", context)
document = desktop.loadComponentFromURL("file:///path/to/file.odt", "_blank", 0, ())Code: Select all
document.dispose()
desktop.terminate()
# context.??
# resolver.??
# local.??
os.kill(pid, signal.SIGTERM)