Archive: nsExec problem


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?

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


hm, right, isn't working for me either, thats strange....i don't think it has something to do with live output...


Will check out.


thanks kichik :)


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


Those are tabs DOCa Cola. I'll see what I can do about it too.


ah i see, thx


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 :(


To use redirection you have to use command.com/cmd.exe. Search the forum using the term "COMSPEC" for usage examples.


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


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

Great! many ideas to try now.
Thanks :)


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

You can always find out what character is and use strcpy to strip it. It's bit of work, but works ;)


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.


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


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


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/


It's probably a carriage return to move the cursor to the start of the line, \r.


so..and how can i get rid of this?

DOCa Cola


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


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.


thx!


- 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


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?


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


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.


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


The solution is in there. Get grep and use this:

myprog.exe bla bla | grep.exe -v "^$"


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


ok..i have come to one problem that my program now sees grep as a command parameter and stopped working....


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.


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


It's just another line, it's not that complicated. You can also make a macro out of it to make it even simpler.