+2006-09-05 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * tkcon.tcl (::tkcon::InitSlave): adjust to make the first file
+ passed in to be argv0 in the slave
+
2006-08-25 Jeff Hobbs <jeffh@ActiveState.com>
* tkcon.tcl (tkcon): default wm protocol to hide tkcon when used
## and slave is created, but before initializing UI or setting packages.
set slaveargs {}
set slavefiles {}
+ set slaveargv0 {}
set truth {^(1|yes|true|on)$}
for {set i 0} {$i < $argc} {incr i} {
set arg [lindex $args $i]
default { lappend slaveargs $arg; incr i -1 }
}
} elseif {[file isfile $arg]} {
+ if {$i == 0} {
+ set slaveargv0 $arg
+ }
lappend slavefiles $arg
} else {
lappend slaveargs $arg
## Create slave executable
if {"" != $OPT(exec)} {
- uplevel \#0 ::tkcon::InitSlave $OPT(exec) $slaveargs
+ InitSlave $OPT(exec) $slaveargs $slaveargv0
} else {
set argc [llength $slaveargs]
set args $slaveargs
# ARGS: slave - name of slave to init. If it does not exist, it is created.
# args - args to pass to a slave as argv/argc
##
-proc ::tkcon::InitSlave {slave args} {
+proc ::tkcon::InitSlave {slave {slaveargs {}} {slaveargv0 {}}} {
variable OPT
variable COLOR
variable PRIV
interp eval $slave { catch {rename ::gets ::tkcon_tcl_gets} }
interp alias $slave ::gets $slave ::tkcon_gets
}
- if {[info exists argv0]} {interp eval $slave [list set argv0 $argv0]}
+ if {$slaveargv0 != ""} {
+ # If tkcon was invoked with 1 or more filenames, then make the
+ # first filename argv0 in the slave, as tclsh/wish would do it.
+ interp eval $slave [list set argv0 $slaveargv0]
+ } else {
+ if {[info exists argv0]} {interp eval $slave [list set argv0 $argv0]}
+ }
interp eval $slave set tcl_interactive $tcl_interactive \; \
set auto_path [list [lremove $auto_path $tk_library]] \; \
- set argc [llength $args] \; \
- set argv [list $args] \; {
+ set argc [llength $slaveargs] \; \
+ set argv [list $slaveargs] \; {
if {![llength [info command bgerror]]} {
proc bgerror err {
global errorInfo