Archive: Problems with nsExec::ExecToLog


Problems with nsExec::ExecToLog
Hi

I am using the following line of code below (in NSIS B3) ... installutil.exe is a commandline tool supplied by Microsoft to install .NET Services. My problem is sometimes it works and sometimes it does not.

ie ... if I run the setup.exe ... it calls this line and works perfect. I can call the setup.exe another time and it "looks" seems to totally ignores this line. I know this as it does not create any .installlog (created by installutil.exe) files in the installdir. I have tried to debug this using exectolog param - but the log window during the installer does not have a scrollable window - so once all the files etc have shot past I cannot see any errors above (think this needs to be changed anyway in NSIS ?) Any ideas ? Anyone done this ? Thanks ...

Banner::show /NOUNLOAD "Installing Whoosh SMS Service ..."
nsExec::ExecToLog '"$PLUGINSDIR\installutil.exe" /showcallstack "$INSTDIR\whooshservice.exe"'
Sleep 5000
Banner::destroy


The log window should have a scroll bar if there is more text than the window can contain. Can you please attach an example compiled installer that shows this behavior?

As for ExecToLog, make sure the working directory is always what you think it is. installutil.exe might be writing the log to the working directory. Use SetOutPath to set the working direcotry.


i know exactly what he means
i am using an extraction program in my installer, sometimes it extracts the files to the pluginsdir and sometimes to the path i have defined with setoutpath
the most time it works is the first time i execute a new compiled setup, the next time i start it the lines are just ignored because he tries to start the extraction program from the pluginsdir where it is not present

DOCa Cola


Well, I'll have to see the script to understand exactly what you're talking about but basically you always have to either have SetOutPath tell the installer exactly where to extract the file or use /oname=. Also make sure you're using b1 and above so SetOutPath will really sets the working directory.


i am using the cvs
i tried it several times with different variantions between $instdir, $instdir\ and so on, that didn't help
The problem does not persist for me because i give "$instdir\program.exe" as command instead of "program.exe", but another problem is that i have to use something like "$instdir\program.exe outdir\" and then it extracts to the pluginsdir (or to where i specified the last setoutpath to) (i am not sure, maybe it sometimes takes the setoutpath before the setoutpath i definied for the extraction, but the strange thing is that it only happens sometimes)
In my extraction program i have given the full path as extraction point and that works

DOCa Cola


Orginally I tried the following :

>>>CODE>>>
Section "Trinet Service" Section1
;The files
SetOutPath "$INSTDIR"
File "..\source\trinetservice.exe"
File "..\source\installutil.exe"
Banner::show /NOUNLOAD "Installing Trinet Service ..."
nsExec::ExecToLog '"installutil.exe" /showcallstack "trinetservice.exe"'
>>>>>>>>>>

Sometimes this work about 50/50 and others it did not ... I thought maybe it was timing - the file had not copied before it was called - so then I tried.


>>>>>CODE>>>>>
Function .onInit

InitPluginsDir
File /oname=$PLUGINSDIR\splash.bmp "splash.bmp"
File /oname=$PLUGINSDIR\installutil.exe "..\source\installutil.exe"

Section "Trinet Service" Section1

;The files

SetOutPath "$INSTDIR"
File "..\source\trinetservice.exe"
Banner::show /NOUNLOAD "Installing Trinet Service ..."
nsExec::ExecToLog '"$PLUGINSDIR\installutil.exe" /showcallstack "trinetservice.exe
>>>>>>>>>>>>>>>

The above worked better - but not 100% of the time. Its just totally random. I would be run the setup, uninstall and then run again and it would not work. When you call installutil.exe it creates a file if it fails or passes called .installlog - I was not seeing this file anywhere on my machine. I run the install and then it was created.

I have used other EXE's like regasm32.exe and its been fine ... I wonder if its something to do with the exe file itself ? with execlog - if it fails does it say that in the log ? Ie cannot find file or something like that ?

Paul


nope, its a problem with nsexec, it sometimes tries to run your program from another location and cannot find the tool, so there it ignores the command


nsExec returns a string on the top of the stack. What does it return for you when it fails?

For example:

nsExec::ExecToLog 'a-program.exe'
Pop $0
MessageBox MB_OK $0