Improve default custom action "Close application" - Advanced Installer Community
ktriendl
Posts: 6
Joined: Thu Jul 13, 2023 10:01 am

Improve default custom action "Close application"

The custom action "Close application" to quit an application is not too useful, unfortunately.
The problem is that it does not wait for the application to terminate, which often leads to a "file in use" condition.

One common sequence of immediate custom actions that I added in our installers is the following:
  1. Close application
  2. Detect process
  3. Bail out of installation process if process detected
This ensures that an application is terminated in the current user session and prevents installation problems if the same application is still executed in other user sessions.
With the default custom action "Close application", the installation process is also stopped prematurely in cases where the application could actually be successfully terminated in the current user session.

Therefore, to make the default custom action "Close application" more useful, it should wait a specified time for the process handle to be signaled.
Catalin
Posts: 7847
Joined: Wed Jun 13, 2018 7:49 am

Re: Improve default custom action "Close application"

Hello Klaus,

Thank you very much for your feedback on this!

Just to make sure, do you have the "Wait for custom action to finish before proceeding" option checked in the "Custom Actions" page? This flag should do just what you need it do.

In the meantime, if the above does not help, please note that you can create your own "Close Application" custom action that will behave exactly how you need it to. For instance, we can create a script that does that.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
ktriendl
Posts: 6
Joined: Thu Jul 13, 2023 10:01 am

Re: Improve default custom action "Close application"

Hi Catalin and team,

yes, I have the option “Wait for custom action to finish before proceeding” enabled.
Since things aren't working (or not reliably), I'm already using a custom action for other installers. I just noticed this behavior again with another product whose installer I'm streamlining.

How exactly does the default custom action wait for the process? With our custom action, I wait for the process handle to be signaled. This is the only point at which the process is actually completed from a system perspective. I have chosen an arbitrary value of 3000 ms for the wait time.
Catalin
Posts: 7847
Joined: Wed Jun 13, 2018 7:49 am

Re: Improve default custom action "Close application"

Hello Klaus,

Thank you for your followup on this!

This is quite strange, as the flag should work just fine for that Custom Action type.

In Windows Installer, there are two types of custom actions, sync and async.

Synchronous and Asynchronous Custom Actions

Custom Action Return Processing Options

When those flags are checked/unchecked, all it happens is that in the "Table Editor", those flags are added in the "Custom Actions" table, as per the second article.

Now, in this case, I would like to investigate this a bit more, if possible. However, unfortunately, I can not really think of a testcase/scenario on how to test this.

Do you think you could provide one where I would see this behavior first hand?

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Feature Requests”