views:

40

answers:

5

For example if App-A tries to installed App-B. Is there any way for App-A to know when App-B is finished installing and can be run?

update

to be specific I am trying to install ChromeSetup.exe on windows using AIR 2.

update 2

Good information guys, after reviewing all your answers is seems like I should run the installer with the -ms argument so it installs silently. Then listen for the NativeProcessExitEvent.Exit event. I will try that and see if it works.

A: 

Installers generally generate logs that give output for events during install. It may be possible in your case to search for a generated log file from App-B installer and look at it to gauge success or failure. But if you're just running the App-B installer as a command line executable you could just invoke it synchronously and wait on it to complete.

bshields
A: 

Typically the installer would just exit and the system() call would return.

Or you can script installers and their own scripting language would control the sequence.

Martin Beckett
Can you elaborate on that a bit? I am confused. I am using AIR-2 which I can listen for output. Would the system call output anything I can listen for? Thanks.
John Isaacks
A: 

Generally speaking, the installer will run as a process, and you can wait for that process to finish. Under POSIX you can use spawn, and quite a few other systems provide the same or least something quite similar.

Jerry Coffin
A: 

It Depends (TM).

Most of the time, the installer for an app is a single executable - so you can launch it and wait until execution comes back to you, but I've seen some unholy messes like "downloader unpacker -> installer downloader -> installer unpacker -> installer" which launched the next executable in the background. Try it with the specific apps you're after and see if the simple system() method works. If not, you'd have to monitor the process list to see if the other installer is done yet.

Piskvor
Thank you, when you say "execution comes back to me" are you referring to synchronous? I think this is running asynchronously but I can listen for the process exit and the process output. so the system() method you are referring to, is that the process exit? ... sorry this is a new area for me.
John Isaacks
@John Isaacks: To keep this language-agnostic (as per your tags), I'll resort to WinAPI terminology: If you invoke the installer process through `ShellExecute`, it will indeed run asynchronously, whereas e.g. `CreateProcess` would run it synchronously by default. I'm sure each development platform has some sort of wrappers around these. "Listening for process exit", are we still language agnostic here, or is this a feature of AIR-2 you're mentioning in another comment? I don't think base WinAPI has this, unless you're hooking `ExitProcess`...
Piskvor
@Piksor, "listening for process exit" is a feature of AIR-2. I originally tried to keep this language agnostic because I didn't think language mattered here (shows what I know) and I thought I would get more responses that way since AIR-2 is so new. But I guess that was a mistake.
John Isaacks
@John Isaacks: Indeed, keeping the question truly language-agnostic would be hard. Use whatever works for you, I guess :)
Piskvor
A: 

If I understand well, you are writing an installer and you want to install Chrome as a pre-requisite or something like that?

If so, you can run the installer silently with the "-ms" parameter according to what I could see on the Web.

Then how to call it depends on which programming language or system you're writing the installer on: for example, from a batch file, you would do

start /wait "" GoogleSetup.exe -ms

but how to call a separate process and wait for its termination depends on the development language and system you're using. Most of them offer functions to launch external processes and wait for their termination almost effortlessly.

Kharlos Dominguez