set trainscmd {
set -x
savelog -c 7 bessar.log
-# (set -ex
+ (set -ex
cd /u/ian/things/trains-bessar/hostside
./stopgap-controller | ./gui-displayer -
-# ) 2>&1 | tee bessar.log
+ ) 2>&1 | tee >(tail -10000 >bessar.log)
}
proc trains_start {} {
global trainsf trainscmd
trains_stop
- set cmdl [list sh -ec $trainscmd 2>@ stderr]
+ set cmdl [list bash -ec $trainscmd 2>@ stderr]
set trainsf [open |$cmdl w]
fconfigure $trainsf -buffering none -blocking no
}
-proc tw {s} {
+proc tw {args} {
global trainsf
if {![info exists trainsf]} return
if {[catch {
- puts $trainsf $s
+ puts $trainsf $args
} emsg]} {
puts stderr "tw: $emsg"
trains_stop
+ } else {
+ puts "tw: $args"
}
}
global power segrev segdet segown movpos
set power 0
set f [open ../layout/ours.dgram-bot.segcmap]
+ fconfigure stdout -buffering none
while {[gets $f l] >= 0} {
if {[regexp {^S (\w+) (\w+)$} $l dummy segname num]} {
set segnum($segname) $num
}
set pointasked M
} elseif {![string compare $pointasked M]} {
- debug "leave point $point pos=$pos manual"
+ debug "leave point $point manual"
return
} else {
set pos $pointasked
proc setup {} {
global port p testonly
+ fconfigure stdout -buffering none
if {!$testonly} {
set p [open $port {RDWR NONBLOCK} 0]
}
proc ask_manual {rightp} { global pointasked; set pointasked M$rightp }
-proc ask_figureeightt {} { global pointasked; set pointasked 0 }
+proc ask_figureeight {} { global pointasked; set pointasked 0 }
proc ask_loop {} { global pointasked; set pointasked 1 }
proc ask_randpath {} { global pointasked; catch { unset pointasked } }