unix.exp (modules-5.1.1.tar.bz2) | : | unix.exp (modules-5.2.0.tar.bz2) | ||
---|---|---|---|---|
skipping to change at line 178 | skipping to change at line 178 | |||
# fetch output asynchronously | # fetch output asynchronously | |||
fileevent $rdstdout readable [list readpipe $rdstdout $rdstderr comp_output] | fileevent $rdstdout readable [list readpipe $rdstdout $rdstderr comp_output] | |||
fconfigure $rdstdout -blocking 0 | fconfigure $rdstdout -blocking 0 | |||
fileevent $rdstderr readable [list readpipe $rdstderr $rdstdout comp_error] | fileevent $rdstderr readable [list readpipe $rdstderr $rdstdout comp_error] | |||
fconfigure $rdstderr -blocking 0 | fconfigure $rdstderr -blocking 0 | |||
# run command in separate thread | # run command in separate thread | |||
lappend cmdlist >@ $wrstdout 2>@ $wrstderr & | lappend cmdlist >@ $wrstdout 2>@ $wrstderr & | |||
if [catch { | if [catch { | |||
eval $cmdlist | {*}$cmdlist | |||
} ] { | } ] { | |||
set comp_exit [lindex $::errorCode 2] | set comp_exit [lindex $::errorCode 2] | |||
} else { | } else { | |||
set comp_exit 0 | set comp_exit 0 | |||
} | } | |||
close $wrstdout | close $wrstdout | |||
close $wrstderr | close $wrstderr | |||
vwait endpipe | vwait endpipe | |||
} | } | |||
skipping to change at line 231 | skipping to change at line 231 | |||
lappend cmdlist 2> test321.err > test321.out | lappend cmdlist 2> test321.err > test321.out | |||
if {$input ne {noinput}} { | if {$input ne {noinput}} { | |||
lappend cmdlist << $input | lappend cmdlist << $input | |||
} | } | |||
if { ! $no_verbose && $verbose > 1 } { | if { ! $no_verbose && $verbose > 1 } { | |||
send_user "starting [lrange $cmdlist 1 end]\n" | send_user "starting [lrange $cmdlist 1 end]\n" | |||
} | } | |||
if [catch { | if [catch { | |||
set comp_output [eval $cmdlist] | set comp_output [{*}$cmdlist] | |||
} ] { | } ] { | |||
set comp_exit [lindex $errorCode 2] | set comp_exit [lindex $errorCode 2] | |||
} else { | } else { | |||
set comp_exit 0 | set comp_exit 0 | |||
} | } | |||
catch { | catch { | |||
set errfile [ open test321.err ] | set errfile [ open test321.err ] | |||
read $errfile | read $errfile | |||
} comp_error | } comp_error | |||
skipping to change at line 367 | skipping to change at line 367 | |||
} else { | } else { | |||
set sub $subshell | set sub $subshell | |||
} | } | |||
set cmd_to_exec [list $shell_path($shell)] | set cmd_to_exec [list $shell_path($shell)] | |||
if {[info exists shell_opts($shell)]} { | if {[info exists shell_opts($shell)]} { | |||
lappend cmd_to_exec $shell_opts($shell) | lappend cmd_to_exec $shell_opts($shell) | |||
} | } | |||
if {$shell eq "cmake"} { | if {$shell eq "cmake"} { | |||
lappend cmd_to_exec "-Dinitfile=$shell_init($shell)" | lappend cmd_to_exec "-Dinitfile='$shell_init($shell)'" | |||
lappend cmd_to_exec "-Dcmdlist='$command'" | lappend cmd_to_exec "-Dcmdlist='$command'" | |||
lappend cmd_to_exec "-P" | lappend cmd_to_exec "-P" | |||
lappend cmd_to_exec $shell_test($shell) | lappend cmd_to_exec $shell_test($shell) | |||
if { $verbose > 0 } { | if { $verbose > 0 } { | |||
send_user " ... Testing '$cmd_to_exec'\n" | send_user " ... Testing '$cmd_to_exec'\n" | |||
} | } | |||
} else { | } else { | |||
lappend cmd_to_exec $shell_test($shell) | lappend cmd_to_exec $shell_test($shell) | |||
if {$autoinit_mode} { | if {$autoinit_mode} { | |||
set autoinit_verb "autoinit " | set autoinit_verb "autoinit " | |||
skipping to change at line 415 | skipping to change at line 415 | |||
# fetch output asynchronously | # fetch output asynchronously | |||
fileevent $rdstdout readable [list readpipe $rdstdout $rdstderr comp_output] | fileevent $rdstdout readable [list readpipe $rdstdout $rdstderr comp_output] | |||
fconfigure $rdstdout -blocking 0 | fconfigure $rdstdout -blocking 0 | |||
fileevent $rdstderr readable [list readpipe $rdstderr $rdstdout comp_error] | fileevent $rdstderr readable [list readpipe $rdstderr $rdstdout comp_error] | |||
fconfigure $rdstderr -blocking 0 | fconfigure $rdstderr -blocking 0 | |||
# run command in separate thread | # run command in separate thread | |||
lappend cmd_to_exec >@ $wrstdout 2>@ $wrstderr | lappend cmd_to_exec >@ $wrstdout 2>@ $wrstderr | |||
if [catch { | if [catch { | |||
eval exec $cmd_to_exec | exec {*}$cmd_to_exec | |||
} ] { | } ] { | |||
set comp_exit [lindex $errorCode 2] | set comp_exit [lindex $errorCode 2] | |||
} else { | } else { | |||
set comp_exit 0 | set comp_exit 0 | |||
} | } | |||
close $wrstdout | close $wrstdout | |||
close $wrstderr | close $wrstderr | |||
vwait endpipe | vwait endpipe | |||
skipping to change at line 483 | skipping to change at line 483 | |||
} else { | } else { | |||
set sub $subshell | set sub $subshell | |||
} | } | |||
set cmd_to_exec [list $shell_path($shell)] | set cmd_to_exec [list $shell_path($shell)] | |||
if {[info exists shell_opts($shell)]} { | if {[info exists shell_opts($shell)]} { | |||
lappend cmd_to_exec $shell_opts($shell) | lappend cmd_to_exec $shell_opts($shell) | |||
} | } | |||
if {$shell eq "cmake"} { | if {$shell eq "cmake"} { | |||
lappend cmd_to_exec "-Dinitfile=$shell_init($shell)" | lappend cmd_to_exec "-Dinitfile='$shell_init($shell)'" | |||
lappend cmd_to_exec "-Dcmdlist='$command'" | lappend cmd_to_exec "-Dcmdlist='$command'" | |||
lappend cmd_to_exec "-P" | lappend cmd_to_exec "-P" | |||
lappend cmd_to_exec $shell_test($shell) | lappend cmd_to_exec $shell_test($shell) | |||
if { $verbose > 0 } { | if { $verbose > 0 } { | |||
send_user " ... Testing '$cmd_to_exec'\n" | send_user " ... Testing '$cmd_to_exec'\n" | |||
} | } | |||
} else { | } else { | |||
lappend cmd_to_exec $shell_test($shell) | lappend cmd_to_exec $shell_test($shell) | |||
if {$autoinit_mode} { | if {$autoinit_mode} { | |||
set autoinit_verb "autoinit " | set autoinit_verb "autoinit " | |||
skipping to change at line 520 | skipping to change at line 520 | |||
$autoinit_verb$command'\n" | $autoinit_verb$command'\n" | |||
} | } | |||
} | } | |||
} | } | |||
if { $verbose > 1 } { | if { $verbose > 1 } { | |||
send_user "starting $cmd_to_exec\n" | send_user "starting $cmd_to_exec\n" | |||
} | } | |||
# now need to capture the exit return code. | # now need to capture the exit return code. | |||
if [catch { | if [catch { | |||
set comp_output [eval exec $cmd_to_exec 2> test321.err > test321.out ] | set comp_output [exec {*}$cmd_to_exec 2> test321.err > test321.out ] | |||
} ] { | } ] { | |||
set comp_exit [lindex $errorCode 2] | set comp_exit [lindex $errorCode 2] | |||
} else { | } else { | |||
set comp_exit 0 | set comp_exit 0 | |||
} | } | |||
catch { | catch { | |||
set errfile [ open test321.err ] | set errfile [ open test321.err ] | |||
read $errfile | read $errfile | |||
} comp_error | } comp_error | |||
skipping to change at line 547 | skipping to change at line 547 | |||
catch { | catch { | |||
set outfile [ open test321.out ] | set outfile [ open test321.out ] | |||
read $outfile | read $outfile | |||
} comp_output | } comp_output | |||
catch { close $outfile } | catch { close $outfile } | |||
catch { file delete test321.out } | catch { file delete test321.out } | |||
} | } | |||
} | } | |||
# | ||||
# Test procedure to lint script files | ||||
# | ||||
# alternative method to collect stdout and stderr from command execution (on | ||||
# Tcl>=8.6): use channel pipe instead of saving these outputs in file | ||||
if {[lindex [lsort -dictionary [list 8.6 [info tclversion]]] 1] eq [info tclvers | ||||
ion]} { | ||||
proc lint_test_xxx_ {filepath} { | ||||
if {[info exists ::endpipe]} { | ||||
unset ::endpipe | ||||
} | ||||
# global variable ::shell corresponds to linter command to use | ||||
if {[auto_execok $::shell] eq {}} { | ||||
untested "linter command '$::shell' not found" | ||||
return | ||||
} | ||||
# prepare command to execute | ||||
set cmd_to_exec [list $::shell] | ||||
if {[info exists ::linter_opts]} { | ||||
lappend cmd_to_exec {*}$::linter_opts | ||||
} | ||||
lappend cmd_to_exec $filepath | ||||
if {$::verbose > 0} { | ||||
send_user " ... Testing '$::shell $filepath\n" | ||||
} | ||||
if {$::verbose > 1} { | ||||
send_user "starting $cmd_to_exec\n" | ||||
} | ||||
# create pipes | ||||
lassign [chan pipe] rdstdout wrstdout | ||||
lassign [chan pipe] rdstderr wrstderr | ||||
# fetch output asynchronously | ||||
fileevent $rdstdout readable [list readpipe $rdstdout $rdstderr comp_output] | ||||
fconfigure $rdstdout -blocking 0 | ||||
fileevent $rdstderr readable [list readpipe $rdstderr $rdstdout comp_error] | ||||
fconfigure $rdstderr -blocking 0 | ||||
# run command in separate thread | ||||
lappend cmd_to_exec >@ $wrstdout 2>@ $wrstderr | ||||
if [catch { | ||||
exec {*}$cmd_to_exec | ||||
} ] { | ||||
set ::comp_exit [lindex $::errorCode 2] | ||||
} else { | ||||
set ::comp_exit 0 | ||||
} | ||||
close $wrstdout | ||||
close $wrstderr | ||||
vwait endpipe | ||||
} | ||||
} else { | ||||
# expect 'lint' testsuite to be run only on Tcl>=8.6 | ||||
proc lint_test_xxx_ {filepath} { | ||||
unsupported {lint testsuite not supported on Tcl<8.5} | ||||
} | ||||
} | ||||
End of changes. 7 change blocks. | ||||
6 lines changed or deleted | 6 lines changed or added |