← Back to team overview

ubuntu-appstore-developers team mailing list archive

Re: Uninstalling apps: is app currently running?

 

On Wed, 2013-09-04 at 17:27 +0100, Colin Watson wrote:

> On Wed, Sep 04, 2013 at 10:29:13AM -0500, Ted Gould wrote:
> > On Wed, 2013-09-04 at 16:53 +0200, Daniel Holbach wrote:
> > > in a brief catch-up call Alejandro asked how we're going to uninstall
> > > apps. Colin explained that there's still the open question about how we
> > > can find out if the app (which is going to be uninstalled) is currently
> > > running or not and what to do about it.
> > > 
> > > This might be a question for Ted (or anyone else working on the
> > > application lifecycle: how can we bring click and the app lifecycle
> > > together in this scenario?
> > 
> > Detecting isn't that difficult.  The part that I don't think we have is
> > how do we "pause" the garbage collector for a limited set of time.  I
> > think that I can get the other parts to work nicely if we have some sort
> > of way to mark a version as held.
> 
> This goes back to the question of whether we 1) have click call out to
> something else to ask whether an app is running before removing it, or
> 2) have something else notify click when apps start and stop in order
> that it can avoid removing them when they're running.  1) means that we
> will often need to run garbage collection later, but 2) means that
> starting and stopping apps now has the overhead of talking to click and
> furthermore sounds rather hard to do reliably.
> 
> So I think 1) is the best option, which means that I need to know what
> specifically I need to do to ask whether a given app ID is currently
> running, and then I can include that when I write the removal code and
> the garbage collector.
> 
> In other words, I cannot answer your question about pausing the garbage
> collector until you answer mine about exactly how to find this
> information :-), and the answer will probably be that the forthcoming
> garbage collector will ask or if necessary have a hook system.
> 
> (Ideally, I'd like to know the best way to do this in both Unity 7 and
> 8.)


Hah, I'll show you mine if you show me yours ;-)

For just prototyping something up there are a set of tools in
upstart-app-launch-tools that can be nicely used with shell scripts.
Assuming you have that installed you can do something like:


        $ upstart-app-launch gedit
        $ upstart-app-list 
        gedit
        $ upstart-app-pid gedit
        31940


It will return an error if there is no application by that ID found.
Here gedit can be any App ID.

In the non-prototyping stage you can use libupstart-app-launch which has
similar functions in it.  I wasn't planning on the tools package being
installed on an image or anything else, it was more to facilitate people
working on the system.  I guess there's no reason they couldn't, but
they'd probably need to be made more robust and have man pages then.

Ted

Attachment: signature.asc
Description: This is a digitally signed message part


Follow ups

References