Old 13th July 2003, 05:10   #1
n0On3
Senior Member
 
n0On3's Avatar
 
Join Date: Jan 2001
Location: Barcelona
Posts: 314
Send a message via ICQ to n0On3
Unhappy nsExec problem

I am trying to use nsExec but It doesn't work.
PHP Code:
      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?
n0On3 is offline   Reply With Quote
Old 13th July 2003, 06:27   #2
DOCa Cola
Senior Member
 
DOCa Cola's Avatar
 
Join Date: Feb 2003
Location: Germany
Posts: 223
Send a message via ICQ to DOCa Cola Send a message via AIM to DOCa Cola Send a message via Yahoo to DOCa Cola
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 is offline   Reply With Quote
Old 13th July 2003, 06:35   #3
DOCa Cola
Senior Member
 
DOCa Cola's Avatar
 
Join Date: Feb 2003
Location: Germany
Posts: 223
Send a message via ICQ to DOCa Cola Send a message via AIM to DOCa Cola Send a message via Yahoo to DOCa Cola
hm, right, isn't working for me either, thats strange....i don't think it has something to do with live output...
DOCa Cola is offline   Reply With Quote
Old 13th July 2003, 14:41   #4
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
Will check out.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 13th July 2003, 19:57   #5
n0On3
Senior Member
 
n0On3's Avatar
 
Join Date: Jan 2001
Location: Barcelona
Posts: 314
Send a message via ICQ to n0On3
thanks kichik
n0On3 is offline   Reply With Quote
Old 13th July 2003, 20:08   #6
DOCa Cola
Senior Member
 
DOCa Cola's Avatar
 
Join Date: Feb 2003
Location: Germany
Posts: 223
Send a message via ICQ to DOCa Cola Send a message via AIM to DOCa Cola Send a message via Yahoo to DOCa Cola
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...
DOCa Cola is offline   Reply With Quote
Old 14th July 2003, 13:54   #7
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
Those are tabs DOCa Cola. I'll see what I can do about it too.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 14th July 2003, 13:57   #8
DOCa Cola
Senior Member
 
DOCa Cola's Avatar
 
Join Date: Feb 2003
Location: Germany
Posts: 223
Send a message via ICQ to DOCa Cola Send a message via AIM to DOCa Cola Send a message via Yahoo to DOCa Cola
ah i see, thx
DOCa Cola is offline   Reply With Quote
Old 16th July 2003, 19:32   #9
n0On3
Senior Member
 
n0On3's Avatar
 
Join Date: Jan 2001
Location: Barcelona
Posts: 314
Send a message via ICQ to n0On3
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
n0On3 is offline   Reply With Quote
Old 16th July 2003, 19:51   #10
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
To use redirection you have to use command.com/cmd.exe. Search the forum using the term "COMSPEC" for usage examples.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 16th July 2003, 19:55   #11
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
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 is offline   Reply With Quote
Old 16th July 2003, 20:02   #12
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Or do this (like Kichik said)
code:

ReadEnvStr $0 COMSPEC
nsExec::Exec '$0 /c "$INSTDIR\grep.exe" -h -i "$4" "$INSTDIR\$1" > "$INSTDIR\t.txt"'



-Stu
Afrow UK is offline   Reply With Quote
Old 17th July 2003, 07:28   #13
n0On3
Senior Member
 
n0On3's Avatar
 
Join Date: Jan 2001
Location: Barcelona
Posts: 314
Send a message via ICQ to n0On3
Great! many ideas to try now.
Thanks
n0On3 is offline   Reply With Quote
Old 18th July 2003, 05:39   #14
DOCa Cola
Senior Member
 
DOCa Cola's Avatar
 
Join Date: Feb 2003
Location: Germany
Posts: 223
Send a message via ICQ to DOCa Cola Send a message via AIM to DOCa Cola Send a message via Yahoo to DOCa Cola
Quote:
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
DOCa Cola is offline   Reply With Quote
Old 19th July 2003, 13:09   #15
n0On3
Senior Member
 
n0On3's Avatar
 
Join Date: Jan 2001
Location: Barcelona
Posts: 314
Send a message via ICQ to n0On3
You can always find out what character is and use strcpy to strip it. It's bit of work, but works
n0On3 is offline   Reply With Quote
Old 19th July 2003, 13:11   #16
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
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.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 22nd July 2003, 05:40   #17
DOCa Cola
Senior Member
 
DOCa Cola's Avatar
 
Join Date: Feb 2003
Location: Germany
Posts: 223
Send a message via ICQ to DOCa Cola Send a message via AIM to DOCa Cola Send a message via Yahoo to DOCa Cola
Thx for taking on the Tab issue, but there is a small bug remaining

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

Last edited by DOCa Cola; 22nd July 2003 at 08:19.
DOCa Cola is offline   Reply With Quote
Old 22nd July 2003, 08:45   #18
ramon18
NSIS Dev
 
ramon18's Avatar
 
Join Date: Apr 2003
Location: Portugal
Posts: 110
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
ramon18 is offline   Reply With Quote
Old 22nd July 2003, 08:52   #19
DOCa Cola
Senior Member
 
DOCa Cola's Avatar
 
Join Date: Feb 2003
Location: Germany
Posts: 223
Send a message via ICQ to DOCa Cola Send a message via AIM to DOCa Cola Send a message via Yahoo to DOCa Cola
hm, when i tried to paste this here it was translated as a new line
---
Decoding shellstr.mp3...

input:
---
parameters in the previous screen

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/

Last edited by DOCa Cola; 22nd July 2003 at 09:23.
DOCa Cola is offline   Reply With Quote
Old 22nd July 2003, 09:19   #20
Sunjammer
Major Dude
 
Join Date: Jun 2002
Location: Swindon, UK
Posts: 559
It's probably a carriage return to move the cursor to the start of the line, \r.
Sunjammer is offline   Reply With Quote
Old 8th August 2003, 12:28   #21
DOCa Cola
Senior Member
 
DOCa Cola's Avatar
 
Join Date: Feb 2003
Location: Germany
Posts: 223
Send a message via ICQ to DOCa Cola Send a message via AIM to DOCa Cola Send a message via Yahoo to DOCa Cola
so..and how can i get rid of this?

DOCa Cola
DOCa Cola is offline   Reply With Quote
Old 8th August 2003, 12:38   #22
DOCa Cola
Senior Member
 
DOCa Cola's Avatar
 
Join Date: Feb 2003
Location: Germany
Posts: 223
Send a message via ICQ to DOCa Cola Send a message via AIM to DOCa Cola Send a message via Yahoo to 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
DOCa Cola is offline   Reply With Quote
Old 8th August 2003, 13:52   #23
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
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.
Attached Files
File Type: zip nsexec.zip (2.9 KB, 211 views)

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 8th August 2003, 13:54   #24
DOCa Cola
Senior Member
 
DOCa Cola's Avatar
 
Join Date: Feb 2003
Location: Germany
Posts: 223
Send a message via ICQ to DOCa Cola Send a message via AIM to DOCa Cola Send a message via Yahoo to DOCa Cola
thx!
DOCa Cola is offline   Reply With Quote
Old 11th August 2003, 10:44   #25
DOCa Cola
Senior Member
 
DOCa Cola's Avatar
 
Join Date: Feb 2003
Location: Germany
Posts: 223
Send a message via ICQ to DOCa Cola Send a message via AIM to DOCa Cola Send a message via Yahoo to DOCa Cola
- 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
DOCa Cola is offline   Reply With Quote
Old 11th August 2003, 15:08   #26
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
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?

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 11th August 2003, 15:13   #27
DOCa Cola
Senior Member
 
DOCa Cola's Avatar
 
Join Date: Feb 2003
Location: Germany
Posts: 223
Send a message via ICQ to DOCa Cola Send a message via AIM to DOCa Cola Send a message via Yahoo to DOCa Cola
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
DOCa Cola is offline   Reply With Quote
Old 11th August 2003, 15:20   #28
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
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.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 11th August 2003, 15:30   #29
DOCa Cola
Senior Member
 
DOCa Cola's Avatar
 
Join Date: Feb 2003
Location: Germany
Posts: 223
Send a message via ICQ to DOCa Cola Send a message via AIM to DOCa Cola Send a message via Yahoo to DOCa Cola
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
DOCa Cola is offline   Reply With Quote
Old 11th August 2003, 15:32   #30
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
The solution is in there. Get grep and use this:

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

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 11th August 2003, 15:36   #31
DOCa Cola
Senior Member
 
DOCa Cola's Avatar
 
Join Date: Feb 2003
Location: Germany
Posts: 223
Send a message via ICQ to DOCa Cola Send a message via AIM to DOCa Cola Send a message via Yahoo to DOCa Cola
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 is offline   Reply With Quote
Old 11th August 2003, 16:08   #32
DOCa Cola
Senior Member
 
DOCa Cola's Avatar
 
Join Date: Feb 2003
Location: Germany
Posts: 223
Send a message via ICQ to DOCa Cola Send a message via AIM to DOCa Cola Send a message via Yahoo to DOCa Cola
ok..i have come to one problem that my program now sees grep as a command parameter and stopped working....
DOCa Cola is offline   Reply With Quote
Old 11th August 2003, 16:13   #33
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
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.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 11th August 2003, 16:27   #34
DOCa Cola
Senior Member
 
DOCa Cola's Avatar
 
Join Date: Feb 2003
Location: Germany
Posts: 223
Send a message via ICQ to DOCa Cola Send a message via AIM to DOCa Cola Send a message via Yahoo to DOCa Cola
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
thx!

DOCa Cola
DOCa Cola is offline   Reply With Quote
Old 11th August 2003, 16:32   #35
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
It's just another line, it's not that complicated. You can also make a macro out of it to make it even simpler.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik 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