Commits

Randy Syring committed 5bd8119

Fix issue with the way we launch tomboy subprocess

it was hanging Launchy when Tomboy wasn't already started

Comments (0)

Files changed (3)

 Changelog
 ---------
 
+0.1.2 released 2012-12-16
+=========================
+
+- fix launching of Tomboy subprocess so Launchy returns immediately
+
 0.1.1 released 2012-12-15
 =========================
 

launchytomboyplugin/lib.py

         self.tomboy_exec('--new-note')
 
     def search_notes(self):
-        self.tomboy_exec()
+        self.tomboy_exec('--search')
 
     def debug_info(self):
         self.debug('Name:', self.name)
             self.debug('First note:', title)
             break
 
-    def debug_actions(self):
-        for title in self.note_titles:
-            self.launch_note(title)
-            break
-        self.new_note()
-
     def tomboy_exec(self, *tomboyargs):
         args = [self.tomboy_exe_path]
         args.extend(tomboyargs)
         self.debug('executing tomboy', args)
-        proc = subprocess.Popen(
+
+        # this invocation will return immediately and allow the subprocess to
+        # continue even if this process ends
+        subprocess.Popen(
             args,
-            stdin=subprocess.PIPE,
-            stderr=subprocess.PIPE,
-            stdout=subprocess.PIPE,
-            )
-        stdout, stderr = proc.communicate()
-        self.debug('cmd return code: ', proc.returncode)
-        self.debug('cmd stdout: ', stdout)
-        self.debug('cmd stderr: ', stderr)
+            close_fds=True
+        )
 
 if __name__ == '__main__':
     ose['LAUNCHY_TOMBOY_DEBUG'] = '1'
     tbl = TomboyLib()
     tbl.debug_info()
-    tbl.debug_actions()
+    tbl.new_note()
+    print 'debug done'
 catalog.  The auto-refresh time period can be set in Launchy options.  A manual
 refresh of the catalog can also be triggered, see Launchy docs for more info.
 
+Known Issues
+------------
+
+If Tomboy is not running and two Tomboy related commands are issued quickly
+in succession, its possible the second Tomboy instance will crash.  Once Tomboy
+is up and running, this is no longer an issue.
+
+Workaround: be patient the first time you use a Tomboy related item with Launchy
+to give the Tomboy process that is started time to fully initialize.
+
 Questions & Comments
 ---------------------