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.

TCL problem

Old posts that have not been replied to for several years.
Locked
m
mindflow
Voice
Posts: 22
Joined: Thu Mar 10, 2005 11:14 am

TCL problem

Post by mindflow »

This is the error i get:

Tcl error [UnReal]: child killed: segmentation violation

this is the code i use:

Code: Select all

        set vara [exec /home/shock/eggdrop/players $mess3 > /tmp/players]
         set of [open "/tmp/players"]
         while {![eof $of]} {
         set line [gets $of] 
         if {$line != ""} {  
              puthelp "PRIVMSG $chan : $line"
         }
        } 
        return 0
}
now to my problem, i cant figure out what cosing the error, nethe how to solve it.

set vara [exec /home/shock/eggdrop/players $mess3 > /tmp/players]

thats the line cosing it, how can i make shure the file /tmp/payers exist ? i dont know how i can add a line that says "true" or "false", somone that have any ideas? :cry:
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

not an eggdrop problem

your external program /home/shock/eggdrop/players crashes and does nothing

you can catch the error and check if the output file exists:

Code: Select all

if ![catch {exec /home/shock/eggdrop/players $mess3 > /tmp/players}] {
  if [file exists /tmp/players] {
    # do stuff
  }
}
m
mindflow
Voice
Posts: 22
Joined: Thu Mar 10, 2005 11:14 am

Post by mindflow »

This is what i can get true partyline:

« bot » Tcl: child killed: segmentation violation
« bot » Tcl: while executing
« bot » Tcl: "exec /home/shock/eggdrop/players $mess3 > /tmp/players"
« bot » Tcl: (procedure "UnReal" line 92)
« bot » Tcl: invoked from within

and line 92 is:

return 0

so shouldent cos any error.. here is the code abow and below it, marked line 92:

Code: Select all

if {$mess == "!find"} {
        set mess2 [string tolower [lindex $arg 1]]
        if {$mess2 == "add"} {
            if {[matchattr $hand m] == 0} {
                puthelp "PRIVMSG $chan :$nick, lamers kan inte adda!!!"
                return 0 <<-- line 92 
            }
            puthelp "PRIVMSG $nick :Roger on that!!!"
            set word2 [string tolower [lrange $arg 2 end]]
            set test [exec echo $word2 >> /home/shock/eggdrop/servers]
            return 0
        }
        set mess3 [lindex $arg 1]
        if {$mess3 == ""} {
            return 0
        }
        set vara [exec /home/shock/eggdrop/players $mess3 > /tmp/players]
         set of [open "/tmp/players"]
         while {![eof $of]} {
         set line [gets $of]
         if {$line != ""} {  
              puthelp "PRIVMSG $chan : $line"
         }
        }
        return 0
}
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

so you rather believe your line counting (and a return that spawns child process and then causes segmentation violation, lol) than my explanation?

*shrug*
m
mindflow
Voice
Posts: 22
Joined: Thu Mar 10, 2005 11:14 am

Post by mindflow »

I tryed your explanation, but didnt work. so still have the same problem, the only thing is that it dosent return the error. so it must be something else.. and i dont know what, cos the same code work just fine on a file called "unreal" .. and it's called the same way and everything.
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

I think you don't know what I was talking about

your script relies on an external program (/home/shock/eggdrop/players) to feed it with results to show on IRC; that program has a bug (defect, if you will) which causes it to crash (terminate abnormally with a "segmentation violation" error message); so the whole issue doesn't have anything to do with TCL or eggdrop and you are in the wrong place to ask for help - contact your "clan" support or whoever happened to write that program
Locked