Skip to content

Commit

Permalink
Adding possibility to disable warning if TesTcl is used with tclsh
Browse files Browse the repository at this point in the history
  • Loading branch information
landro committed Aug 7, 2015
1 parent 9c1e019 commit 9d75668
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
4 changes: 4 additions & 0 deletions examples.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#!/bin/bash

# Set to false in order to provoke warning during package loading
export DISABLE_TESTCL_INTERPRETER_WARNING=true;

for f in examples/example_*.tcl
do
if [ 'tclsh' == "$1" ] ; then tclsh "$f";
Expand Down
2 changes: 1 addition & 1 deletion irules/advanced_irule.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ rule advanced {
}
} elseif { [HTTP::uri] eq "/blocked" } {
HTTP::respond 403
} elseif { [HTTP::uri] starts_with "/app" } {
} elseif { [regexp {^/app} [HTTP::uri]] } {
if { [active_members pool_application] == 0 } {
if { [HTTP::header User-Agent] eq "Apache HTTP Client" } {
HTTP::respond 503
Expand Down
5 changes: 4 additions & 1 deletion pkgIndex.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ if {[namespace exists ::testcl]} {
return
}

set disable_interpreter_warning [ expr { [ array names env DISABLE_TESTCL_INTERPRETER_WARNING ] ne "" && $env(DISABLE_TESTCL_INTERPRETER_WARNING) eq "true"} ]

if { $::tcl_platform(platform) eq "java" } {

if { [catch { expr {"abc" starts_with "a"} } errormsg ] } {
Expand All @@ -35,7 +37,8 @@ if { $::tcl_platform(platform) eq "java" } {
puts stderr "WARNING"
}

} else {
} elseif { ! $disable_interpreter_warning } {

puts stderr "WARNING"
puts stderr "WARNING You're using a Tcl interpreter that doesn't support the jtcl-irule extension"
puts stderr "WARNING which requires the java based JTcl interpreter"
Expand Down
4 changes: 4 additions & 0 deletions tests.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#!/bin/bash

# Set to false in order to provoke warning during package loading
export DISABLE_TESTCL_INTERPRETER_WARNING=true;

for f in test/test_*.tcl
do
if [ 'tclsh' == "$1" ] ; then tclsh "$f";
Expand Down

0 comments on commit 9d75668

Please sign in to comment.