← Back to team overview

kabikaboo team mailing list archive

[Bug 501644] Re: v1.7 - Duplicate Instance Detection Fails

 

The 'normal' linux-ey way to do it is to write a PID file with the id of
the Kabikaboo process inside it. The program then checks to see if that
particular process is running and errors out if it is; if not, it
replaces the old pid inside the file with the new pid. Makes cleanups a
little less 'meh' with lockfiles and makes it easier to maintain if the
command line suddenly changes and so the output of ps -ax isn't what is
expected. (Sorry if that's incoherant, no time to wake up yet).

>From what I can tell, the Windows alternative is either A. A lockfile or
B. something called a 'mutex', which looks like some sort of process-
unique identifier that other processes can examine. Lookie here:
http://code.activestate.com/recipes/474070/

Of course, with some 'if win32:' ... 'else:' code... in between...
No time to work until this evening, but might get around to prodding around

-- 
v1.7 - Duplicate Instance Detection Fails
https://bugs.launchpad.net/bugs/501644
You received this bug notification because you are a member of Kabikaboo
Team, which is subscribed to Kabikaboo.

Status in Kabikaboo: New

Bug description:
In 1.6 this worked.  
It should be a simple fix for Linux.

Modify the search function in kabikaboo.py ~ line 2938:

# check for duplicate instance of kabikaboo
    def check_for_duplicate_instance(self):
        result = False
        # WARNING: LINUX ONLY CODE
        output = commands.getoutput('ps -ax')
        # check for 2 or more regular instances
        if output.count('python kabikaboo.py') >= 2:
            result = True
        # check for instance and development instance
        if output.count('python kabikaboo.py') >= 1 and output.count('python -W ignore::DeprecationWarning kabikaboo.py') >= 1:
            result = True
        if result:
            print 'Duplicate instance of Kabikaboo already running.'
            print 'Will not open last file in this case.'
            print 'Starting with new document.'
            self.file.working_file = ''
        return result

Windows will need different code to do this.





References