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 

exec in backround/with callback possible?

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
sKy
Op


Joined: 14 Apr 2005
Posts: 194
Location: Germany

PostPosted: Mon Feb 06, 2006 4:22 pm    Post subject: exec in backround/with callback possible? Reply with quote

Hey

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?

best regards
sKy
_________________
socketapi | Code less, create more.
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Mon Feb 06, 2006 10:00 pm    Post subject: Reply with quote

You can use
Code:
open "|<command>"

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.
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Tue Feb 07, 2006 12:02 am    Post subject: Reply with quote

search for "tail -f"
_________________
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use [code] tag when posting logs, code
Back to top
View user's profile Send private message Visit poster's website
sKy
Op


Joined: 14 Apr 2005
Posts: 194
Location: Germany

PostPosted: Tue Feb 07, 2006 3:48 pm    Post subject: Reply with quote

My failure, i forgot to add thats about windrop.

exec and open |
will always return an error like:
Tcl error: couldn't create error file for command: no such file or directory

Is it possible to fix that?

EDIT:
BgExec ( http://wiki.tcl.tk/12704 ) won`t work too, cause the mainproc is going to use open | aswell too.

Is there any way to execute something (windrop)?
_________________
socketapi | Code less, create more.
Back to top
View user's profile Send private message
sKy
Op


Joined: 14 Apr 2005
Posts: 194
Location: Germany

PostPosted: Mon Feb 20, 2006 5:55 pm    Post subject: Reply with quote

anyone?
_________________
socketapi | Code less, create more.
Back to top
View user's profile Send private message
Alchera
Revered One


Joined: 11 Aug 2003
Posts: 3344
Location: Ballarat Victoria, Australia

PostPosted: Mon Feb 20, 2006 7:44 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Mon Feb 20, 2006 7:50 pm    Post subject: Reply with quote

what's the Tcl version?

this thing looks pretty ancient to me
_________________
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use [code] tag when posting logs, code
Back to top
View user's profile Send private message Visit poster's website
sKy
Op


Joined: 14 Apr 2005
Posts: 194
Location: Germany

PostPosted: Mon Feb 20, 2006 8:23 pm    Post subject: Reply with quote

i got it from here
http://windrop.sourceforge.net/downloads.html

before i got Eggdrop v1.6.17 Handlen32 (08.07.2005)

and now i`ve updated to Eggdrop v1.6.18+spelling-errors-suck Handlen32 (25.12.2005)
info tclversion 8.4
info patchlevel 8.4.12

the error still comes up.
it`s not cause i use handlen32 version? (i doub`t that this has anything to do with it)

btw: what means "spelling-errors-suck"?
_________________
socketapi | Code less, create more.
Back to top
View user's profile Send private message
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Mon Feb 20, 2006 8:52 pm    Post subject: Reply with quote

check your temp-path and if you have c:\tmp; also check the FAQ at windrop's website

or wait for DeKus, he's our windrop guru; I personally have never used the thing, Windows is desktop OS to me
_________________
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use [code] tag when posting logs, code
Back to top
View user's profile Send private message Visit poster's website
sKy
Op


Joined: 14 Apr 2005
Posts: 194
Location: Germany

PostPosted: Fri Feb 24, 2006 10:36 am    Post subject: Reply with quote

The temp path is correct (otherwise the bot won`t start).

--

from here: http://wiki.tcl.tk/12704 (is working anyway, eggdrop just doesn`t have the command auto_execok)
Code:
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
_________________
socketapi | Code less, create more.
Back to top
View user's profile Send private message
De Kus
Revered One


Joined: 15 Dec 2002
Posts: 1361
Location: Germany

PostPosted: Sat Feb 25, 2006 7:22 am    Post subject: Reply with quote

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:
Code:
~$ 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 Smile.
_________________
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
Back to top
View user's profile Send private message MSN Messenger
sKy
Op


Joined: 14 Apr 2005
Posts: 194
Location: Germany

PostPosted: Sun Feb 26, 2006 9:54 pm    Post subject: Reply with quote

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?

DeKus: May I pm you on irc?
_________________
socketapi | Code less, create more.
Back to top
View user's profile Send private message
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Mon Feb 27, 2006 12:33 am    Post subject: Reply with quote

report the bug to windrop dev folks, we can't help you any further
_________________
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use [code] tag when posting logs, code
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting 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