Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 11th June 2009, 16:53   #1
greylightning
Junior Member
 
Join Date: Jun 2009
Posts: 3
How to wait for NSIS-created installer to complete in silent mode?

Hi NSIS developers,

When running an NSIS-created installer in silent mode from the command line, I have found that the shell will return immediately, while the installer continues to run in a separate process.

Do you know how I can configure my NSIS-created installer so that completion of the install process will be waitable by the shell? The use case here is a third-party scripting system that needs to consume my installer in a way that waits for my installer process to complete before starting the next task. My installer is expected to run in silent mode and then return when it is fully complete.

I have noted another problem with the SilentInstall command. Perhaps this is related. Setting "SilentInstall silent" does not seem to have any effect. If I call my installer on the command line with "/S" it does launch a silent mode install.

Do any of you superpimps have advice on how to do this? Or if the answer is just 'no,' then I will groan and go ahead with switching to MSI (oh god MS toolchain why why).
greylightning is offline   Reply With Quote
Old 11th June 2009, 18:10   #2
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
In command prompt/batch files one must use start /wait for non console apps. In C/C++ you'd use WaitForSingleObject() on the process handle and in .NET you'd use process.Wait*****it(). I think you must be mistaken with your findings.

Stu
Afrow UK is offline   Reply With Quote
Old 11th June 2009, 18:50   #3
greylightning
Junior Member
 
Join Date: Jun 2009
Posts: 3
Thanks for the advice, Stu.

I was not able to get the desired wait behavior with the following bat file. Do you have any idea what might be wrong?

I created a bat file containing the following text:

@echo off
start "Installer" /wait /B "Installer.exe" /S

I then executed the batch file from a cmd.exe prompt. The command prompt still immediately returns from executing the script, while the installer runs in a detached process.

If I omit the /S, then it waits for the GUI installer to complete, the same as if I executed the installer directly from a command prompt. But the goal of this exercise is to wait for the silent-mode installer to complete. Any ideas?

Last edited by greylightning; 11th June 2009 at 19:16.
greylightning is offline   Reply With Quote
Old 11th June 2009, 19:04   #4
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Using /B stops that code working at all as NSIS installers aren't console applications. Either way, with or without /S (and without /B) it waits for me. It never waits when run directly without using start /wait for me.

Stu
Afrow UK is offline   Reply With Quote
Old 11th June 2009, 19:15   #5
greylightning
Junior Member
 
Join Date: Jun 2009
Posts: 3
Ah, excellent! Removing /B did the trick. Thank you!
greylightning is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump