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.

exec/log and strange error

Help for those learning Tcl or writing their own scripts.
Post Reply
S
Saibot
Voice
Posts: 3
Joined: Mon Aug 23, 2010 7:55 am

exec/log and strange error

Post by Saibot »

I wrote this script:

Code: Select all

bind pub o .shutdown shutdown
bind pub o .run run

set logfile "logs/exec/beehive.log"
set log [open $logfile a]
proc shutdown { nick uhost handle chan text } {
   global log logfil
  # set docmd [exec ./shutbeehive]
   putserv "PRIVMSG $chan :\0034Beehive is shutting down... \003"
   puts $log "$nick\n[strftime "%Y %b %d %a %T"]:\n Shutdown"
}

proc run { nick uhost handle chan text } {
   global log logfil
   #set docmd [exec ./runbeehive]
   putserv "PRIVMSG $chan :\0034Beehive is starting...please wait. \003"
   puts $log "$nick\n[strftime "%Y %b %d %a %T"]:\n Start"
   }
close $log
but i have a very strange error:

Code: Select all

Tcl error [run]: can not find channel named "file14"
if i use the .shutdown i have same problem.
i dont understand what is it.
pls help me.
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

Rather obviously, you close the file handle (aka channel) right after you open it.. Thus it is no longer open for write-access when you call either of the two commands.
NML_375
Post Reply