From 957c80e02f221c65bd824d768a1de766513576f8 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 23 Jun 2012 23:09:36 +0530 Subject: [PATCH] calibre -s now waits for calibre to shutdown --- manual/creating_plugins.rst | 2 +- src/calibre/gui2/main.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/manual/creating_plugins.rst b/manual/creating_plugins.rst index 5963f4a890..f39b60dad9 100644 --- a/manual/creating_plugins.rst +++ b/manual/creating_plugins.rst @@ -195,7 +195,7 @@ It can get tiresome to keep re-adding a plugin to calibre to test small changes. Once you've located the zip file of your plugin you can then directly update it with your changes instead of re-adding it each time. To do so from the command line, in the directory that contains your plugin source code, use:: - calibre -s; sleep 4s; zip -R /path/to/plugin/zip/file.zip *; calibre + calibre -s; zip -R /path/to/plugin/zip/file.zip *; calibre This will shutdown a running calibre. Wait for the shutdown to complete, then update your plugin files and relaunch calibre. It relies on the freely available zip command line tool. diff --git a/src/calibre/gui2/main.py b/src/calibre/gui2/main.py index 94c2ffa384..d787dbae58 100644 --- a/src/calibre/gui2/main.py +++ b/src/calibre/gui2/main.py @@ -323,6 +323,10 @@ def communicate(opts, args): if opts.shutdown_running_calibre: t.conn.send('shutdown:') + from calibre.utils.lock import singleinstance + prints(_('Shutdown command sent, waiting for shutdown...')) + while not singleinstance('calibre GUI'): + time.sleep(0.1) else: if len(args) > 1: args[1] = os.path.abspath(args[1])