[Adium-devl] Let's abandon disk images
Graham Booker
adium at cod3r.com
Sat Mar 31 22:30:39 UTC 2007
On Mar 31, 2007, at 4:38 PM, Ofri Wolfus wrote:
> I'm not really seeing the problem here.
> 1. Launch the copied app from /Applications.
> 2. fork/exec.
> 3. Parent calls exit() while the child does that system voodoo or
> whatever, possibly prefixed by sleep() to make sure the parent
> terminated.
>
> Sounds reasonable (I have very little experience in this area)?
>
Yes, and that is what I was suggesting, sort of. My complaint is
against using system and I proposed using fork/exec in its place
(where the exec does an exec on /bin/sh rather that using system,
thus allowing the application image to be unused). That is the limit
of my complaint. If we were to implement this using fork/exec, I see
the script being a bit cleaner, and accomplishing a more useful goal.
I would change some of the order of operations above though. We want
Adium quit before we launch the next one, so I propose:
1) fork/exec to the little script
2) script does its sleep magic to wait for application to quit
3) script checks to make sure the app quit and all Adiums (with the
current user's uid) are quit rather than it just timing out
4) script launches new adium
5) script unmounts disk image
6) script quits
> - Ofri
>
> - - - - - - - - - - - - - - - - - - -
> http://www.dpompa.com
> - - - - - - - - - - - - - - - - - - -
>
>
> On 01/04/2007, at 00:04, Graham Booker wrote:
>
>> The advantage of the above script is that it waits for the
>> existing app to quit before it does the relaunch, and so in
>> theory, the disk image should no longer be in use. Although, I
>> have issues with using system to launch an bash process which
>> waits for the parent pid to exit. System launches sh with the
>> argument passed into it, and blocks until the sh finishes. The sh
>> then launches the bash process with the script in it in the
>> background. The bash process waits in a loop for its parent to
>> finish, which is the sh process, not the application itself. It
>> seems to be sheer luck that the above works. I would prefer it to
>> wait on a particular pid, which the application gives it, but that
>> is just me.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://adium.im/pipermail/devel_adium.im/attachments/20070331/c874d9c3/attachment-0001.html>
More information about the devel
mailing list