- NSIS Discussion
- nsExec problem
Archive: nsExec problem
n0On3
13th July 2003 06:10 UTC
nsExec problem
I am trying to use nsExec but It doesn't work.
nsExec
::ExecToLog/TIMEOUT=9999"$INSTDIR\grep.exe"
I tried with an without the timeout.
I think that the problem is with
grep.exe because when I run it from a batch it doesn't close the window and remains open (usually a batch closes the window).
The log should reflect this:
Usage: grep [OPTION]... PATTERN [FILE]...
Try `grep --help' for more information.
but it doesn't
I found
this thread with similar problems. I don't know if it's the same, since this grep.exe just makes a list, and they talk about getting live output or nsExec not getting the output until the program has finished. In my case, nsExec never grabs the output.
I forgot to say that the return value is 1 (no errors, timeout, or whatever).
note: why can't I write backslashes?
DOCa Cola
13th July 2003 07:27 UTC
First of all the link says that the server is too busy, here is an alternate link. i will test grep.exe now...
http://sunsite.utk.edu/ftp/usr-218-2...nu/grep24b.zip
DOCa Cola
13th July 2003 07:35 UTC
hm, right, isn't working for me either, thats strange....i don't think it has something to do with live output...
kichik
13th July 2003 15:41 UTC
Will check out.
n0On3
13th July 2003 20:57 UTC
thanks kichik :)
DOCa Cola
13th July 2003 21:08 UTC
At this point, here another thing i noticed is that nsexec makes these boxes in front of the output of lame (mp3 encoder). in the dos box they aren't there...
http://www.borgcore.de/outerspace/NSIS/lame.png
kichik
14th July 2003 14:54 UTC
Those are tabs DOCa Cola. I'll see what I can do about it too.
DOCa Cola
14th July 2003 14:57 UTC
ah i see, thx
n0On3
16th July 2003 20:32 UTC
I found another grep.exe that works with NSIS. But now I have another problem :( As kichik said in another thread, stack items are only 1024Bytes, so when the program lauched through nsExec ExecToStack prints more than 1024 it gets lost :(
I tried my best to redirect with "> t.txt" but I am quite unlucky in this thread and couldn't make it work, either.
I tried many variations of this:
ExecWait `"$INSTDIR\grep.exe" -h -i "$4" "$INSTDIR\$1" > "$INSTDIR\t.txt"`
and none works :(
kichik
16th July 2003 20:51 UTC
To use redirection you have to use command.com/cmd.exe. Search the forum using the term "COMSPEC" for usage examples.
Afrow UK
16th July 2003 20:55 UTC
You can't log output using ExecWait let alone without using MS-DOS.
Use the WriteToFile function and create a batch file with the above (you're) command-line.
Then execute the batch using nsExec::Exec
The logging feature is an MS-DOS feature.
-Stu
Afrow UK
16th July 2003 21:02 UTC
Or do this (like Kichik said)
ReadEnvStr $0 COMSPEC
nsExec::Exec '$0 /c "$INSTDIR\grep.exe" -h -i "$4" "$INSTDIR\$1" > "$INSTDIR\t.txt"'
-Stu
n0On3
17th July 2003 08:28 UTC
Great! many ideas to try now.
Thanks :)
DOCa Cola
18th July 2003 06:39 UTC
Originally posted by kichik
Those are tabs DOCa Cola. I'll see what I can do about it too.
Hm, is there a way to replace the tab boxes with nothing or 'real' tabs with exectostring or something. i need this fix soon cause i am going to release an installer with that.
DOCa Cola
n0On3
19th July 2003 14:09 UTC
You can always find out what character is and use strcpy to strip it. It's bit of work, but works ;)
kichik
19th July 2003 14:11 UTC
Sorry, missed your message the first time. If it's really urgent drop by the IRC channel and I'll compile a version of nsExec for you that will temporarily solve this.
DOCa Cola
22nd July 2003 06:40 UTC
Thx for taking on the Tab issue, but there is a small bug remaining
http://www.borgcore.de/outerspace/NSIS/mmpack.png
The first character of the executed program seems to be untouched by that (after "decoding shellstr.mp3..." the nsexec command with lame starts)
DOCa Cola
ramon18
22nd July 2003 09:45 UTC
DOCa Cola, I will check this, but can you examine what char is it? TAB char left or another one? Can you please post the link to the tool you are using and an example of the parameters used so I can check it more quickly? thanks
cya later,
Ramon
DOCa Cola
22nd July 2003 09:52 UTC
hm, when i tried to paste this here it was translated as a new line
---
Decoding shellstr.mp3...
input:
---
parameters in the previous screen
http://www.borgcore.de/outerspace/NSIS/lame.png
Note: as you can see, all boxes have been fixed but not the one at the beginning
http://lame.sourceforge.net
Download: http://mitiok.cjb.net/
Sunjammer
22nd July 2003 10:19 UTC
It's probably a carriage return to move the cursor to the start of the line, \r.
DOCa Cola
8th August 2003 13:28 UTC
so..and how can i get rid of this?
DOCa Cola
DOCa Cola
8th August 2003 13:38 UTC
Ok, here a ready to test simple installer using lame (all required files included)
http://www.borgcore.de/outerspace/nsis/lameinst.zip
hope it is easier now to determine the bug
DOCa Cola
kichik
8th August 2003 14:52 UTC
In latest CVS version I have fixed:
- Empty lines were not printed
- CR or LF alone were not handled
- Tab conversion removed the next char
Thanks for the example, it was handy.
nsExec.dll from latest CVS attached so you won't have to wait for the CVS delays.
DOCa Cola
8th August 2003 14:54 UTC
thx!
DOCa Cola
11th August 2003 11:44 UTC
- Empty lines were not printed
oh, is there a way to surpress this feature optionally? i have another program i execute with nsexec::exectolog now just prints out to many empty lines into my log
DOCa Cola
kichik
11th August 2003 16:08 UTC
There is no option to turn it off. Why would you want to do it? Does it print more empty lines than seen when executing the program without nsExec?
DOCa Cola
11th August 2003 16:13 UTC
no the line size is correct in nsis, but the lines just exist to fill out the standard dos screen size, so there are a few empty lines not needed in nsis, it worked well without the printed empty lines. is it to complicated to make that optional? than i maybe could find another solution for that, but i thought such a feature might be helpful not to overload the nsis log with unnecessary empty lines.
DOCa Cola
kichik
11th August 2003 16:20 UTC
It's not that complicated, but I am trying to finish something else right now. You can use Afrow's/Brainsucker's scripts for removing lines in log for now. You can also use some of the methods described here:
http://www.experts-exchange.com/Prog..._20640729.html
Although mainly for *nix, there are ports of the applications discussed there to Windows.
DOCa Cola
11th August 2003 16:30 UTC
yea, but i don't want to remove empty lines from a generated log file but from the output with showinstdetails. i can't see a solution how to solve this with such a program...ok, but anyway, i don't want to bother you, i will wait until you have time to add an option for that
DOCa Cola
kichik
11th August 2003 16:32 UTC
The solution is in there. Get grep and use this:
myprog.exe bla bla | grep.exe -v "^$"
DOCa Cola
11th August 2003 16:36 UTC
owww, i am too blind, sorry, the commands just overtook me and i thought he wants to remove empty lines from a file, thx for the help! great support here! thx! :)
DOCa Cola
DOCa Cola
11th August 2003 17:08 UTC
ok..i have come to one problem that my program now sees grep as a command parameter and stopped working....
kichik
11th August 2003 17:13 UTC
Right, forgot to mention you need the command line processor for this. You must use %COMSPEC% to make this work. Search for COMSPEC in the forum, there are lots of examples.
DOCa Cola
11th August 2003 17:27 UTC
owww, i see, but this is getting way to complicated, the thing is that i not only have one line of nsexec::exectolog and i don't want to change 20 commands around 2 times, so until then i will use the older nsexec where the bug was existend :D
thx!
DOCa Cola
kichik
11th August 2003 17:32 UTC
It's just another line, it's not that complicated. You can also make a macro out of it to make it even simpler.