This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

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

General support and discussion of Eggdrop bots.
Post Reply
w
willyw
Revered One
Posts: 1203
Joined: Thu Jan 15, 2009 12:55 am

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

Post by willyw »

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
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

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: Select all

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
w
willyw
Revered One
Posts: 1203
Joined: Thu Jan 15, 2009 12:55 am

Post by willyw »

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: Select all

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.
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.
w
willyw
Revered One
Posts: 1203
Joined: Thu Jan 15, 2009 12:55 am

Post by willyw »

Code: Select all

.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.
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

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
w
willyw
Revered One
Posts: 1203
Joined: Thu Jan 15, 2009 12:55 am

Post by willyw »

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.
:)
Thanks!
Post Reply