egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Is there a trick to using .tcl exec ? (Windrop)

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Eggdrop Help
View previous topic :: View next topic  
Author Message
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Tue Nov 10, 2009 3:23 pm    Post subject: Is there a trick to using .tcl exec ? (Windrop) Reply with quote

Hello,

Found a script I wanted to try, and it errors. Narrowed it down to the
exec command.

Tried some experimenting, and didn't figure it out yet.
Always get this: couldn't create error file for command: no such file or directory


Even tried in partyline: .tcl exec dir
and get:
<botnick> [14:19] tcl: evaluate (.tcl): exec dir
<botnick> Tcl error: couldn't create error file for command: no such file or directory

I'm pretty sure I've used exec on a linux eggdrop, and it worked ok.
But this is a Windrop I'm working on this time.

There must be something simple I've missing....


(I see it mentioned, with a search here, but I didn't find a definitive answer to the problem. )


Thanks
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Tue Nov 10, 2009 4:07 pm    Post subject: Reply with quote

Well, the error is simple enough. On windows system, there is no binary named dir (that's an internal command in the "dos prompt"/"command prompt" - aka command.com or cmd.exe). As such, you'll have to launch the command promt and pass on the "dir" command to it.
Code:
exec command.exe /c dir


So, simple enough, the exec command can only launch binaries with either full path, or located within the search path. It will not load any external command parsers such as command.com automatically.
The very same applies under linux-systems; I.E you cannot use the Bash internal command "jobs" directly from the exec command, but you need to load a bash shell first...
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Tue Nov 10, 2009 8:14 pm    Post subject: Reply with quote

nml375 wrote:
Well, the error is simple enough. On windows system, there is no binary named dir (that's an internal command in the "dos prompt"/"command prompt" - aka command.com or cmd.exe). As such, you'll have to launch the command promt and pass on the "dir" command to it.
Code:
exec command.exe /c dir


So, simple enough, the exec command can only launch binaries with either full path, or located within the search path. It will not load any external command parsers such as command.com automatically.


Ahh...
I hadn't considered that.
Thanks.

Quote:

The very same applies under linux-systems; I.E you cannot use the Bash internal command "jobs" directly from the exec command, but you need to load a bash shell first...


That sounds like what I did. ... a bash script. First line would have loaded the shell.
It's been a while... I'd have to go check to be sure though.
Back to top
View user's profile Send private message
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Tue Nov 10, 2009 8:17 pm    Post subject: Reply with quote

Code:

.tcl exec command.exe /c dir


is what I just tried.
and here is what I get:

<botnick> [19:11] tcl: evaluate (.tcl): exec command.exe /c dir
<botnick> Tcl error: couldn't create error file for command: no such file or directory


heheeh
I must be blind.
I can't see it... I must be missing something. Sorry.
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Tue Nov 10, 2009 9:05 pm    Post subject: Reply with quote

Sorry, overlooked the "couldn't create error file" part :/
The error is thrown by the TclCreatePipeline function, which is responsible for building the needed pipes (if any) and tracking the pid's of all generated subprocesses.

Since the exec command supports pipes, tcl has to establish the means of the pipes. This is partly done using TclpCreateTempFile() (creates an opened, deleted file). In the windows-ported version it should create this file in the system temporary directory, or wherever your TMP or TEMP environment variable points at. If this function fails to return a valid TclFile resource, the above mentioned error is thrown.

You could try adding "2>@1" to the end of the command line, as this will redirect any output to stdErr to stdOut, removing the need for a separate error file alltogether.
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Wed Nov 11, 2009 9:01 pm    Post subject: Reply with quote

nml375 wrote:

...
You could try adding "2>@1" to the end of the command line,
...


Not sure of exactly what all that is/does, but that sure made a difference.
Smile
Thanks!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Eggdrop Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber