I want a eggdrop to start a external application. Exec wait`s until the prozess ends and will block anything else. Thats what i want to prevent. Is there a way to start a process and to get a callback after it?
instead, which is supposed to do the same without waiting like exec does.
A forum search on the topic will result in great information about it. Also, you can take a look at bgexec.tcl by strikelight which does what you want.
You'll need to find the appropriate ported Unix tools to use with Windrop or install cygwin and compile them yourself. The tool(s) are then copied into your Windrop main folder.
Add [SOLVED] to the thread title if your issue has been. Search | FAQ | RTM
set redir [expr {[info patchlevel] >= "8.4.7"?{2>@1}:{2>@stdout}}]
if [catch {open "| $prog $redir" r} pH] {
i wonder that i can open and execute something on that way. but i don`t really understand why. could someone explain what these changes do?
2>@1
2>@stdout
you can savely delete them for your script. > changes the default output (stdout) which is usually the console (which you read from with gets/read). example from tclsh console:
~$ tclsh
% open "| uname" r
file3
% read file3
Linux
% close file3
%
I hope you will understand now better how it works. Don't forget to use fileevent for true asyncronous acces (this above is syncron, too).
So dont forget to save the return value of open, because you will need it to read from .
Thank you, but i know how open | and exec work. =) My code works already on unix/eggdrop system without problems.
My tests:
- with unix: eggdrop 1.6.17 - working fine
channelid`s like file3
- with unix: tclsh - working fine
channelid`s like file3
- with windows xp: windrop 1.6.17 - Tcl error: couldn't create error file for command: no such file or directory
- with windows xp: 1.6.18cvs - Tcl error: couldn't create error file for command: no such file or directory
- with windows xp: 1.6.16 - working fine
(but this version is outdated, i don`t really want to use it)
the channelid`s are like file107e0560
the incomprehensible was that this (from bgExec):
set redir [expr {[info patchlevel] >= "8.4.7"?{2>@1}:{2>@stdout}}]
if [catch {open "| $prog $redir" r} pH] {
will work with windrop 1.6.17 and 1.6.18cvs [but for read acess mode r only :/].
I think the problem is about the windrop/cygwin/tcl version? Is there another solution then using windrop 1.6.16?