← Back to team overview

kabikaboo team mailing list archive

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

 

Well, after thinking about this a bit and trying a few ideas last night,
I realized something: right now, Kabikaboo detects if another instance
of itself is running to prevent overwriting a single file, since
Kabikaboo can currently only open one file at a time. If this is the
case, what would be the advantages and disadvantages of having Kabikaboo
detect if a file is currently in use (With a Word-style 'lock' file,
perhaps?) instead of detecting if another version is running? Then, it
would be possible to have two instances running on different files.
(*And*, this would not require Linux/Win specific code--just code to
detect if the directory where a file resides--or possibly the user's
.kabikaboo or even ~ directory--has a filename.doc.tmp file to see if it
is currently in use. Kabikaboo would create the (empty) file on opening
filename.doc and remove the temporary lockfile on close (checking to
make sure it can write to the lockfile, of course--maybe have a fallback
system: first try the directory where the document is, then try ~, then
give an error?)

Just spewing some thoughts. The current system doesn't--or didn't--allow
two instances working on *different* files. Also, if we wanted full
duplicate instance detection, it'd be necessary to kill the second
instance of Kabikaboo completely upon detection of the first instance,
instead of allowing it to load with a blank template (and that second
instance could be used to open the file being used by the first
instance...)

In fact, now that I think about it, it'd be necessary to check if the
file was in use through the Open dialog, too, instead of just on
autoload. Maybe only allowing a single instance *would* be easier...a
single .pid file for Linux and a mutex for Windows.

Thoughts?

-- 
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: Confirmed

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