Skip to content

Commit 2041bc6

Browse files
committed
Test pipe and spawn for tcl
1 parent 9282d97 commit 2041bc6

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

tcl/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ test-spawn:
1212
$(TCLSH) test.tcl spawn
1313

1414
test-pipe:
15+
$(R2) -qi test.tcl /bin/ls
1516
$(R2) -q0 -c '#!pipe $(TCLSH) test.tcl pipe' /bin/ls
1617

1718
clean:

tcl/test.tcl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,17 @@ proc test_pipe {} {
2424
$r2 close
2525
}
2626

27-
set mode [expr {$argc > 0 ? [lindex $argv 0] : "spawn"}]
27+
if {[info exists ::env(R2PIPE_IN)] && [info exists ::env(R2PIPE_OUT)]} {
28+
set mode pipe
29+
} elseif {[info exists argc] && $argc > 0} {
30+
set mode [lindex $argv 0]
31+
} else {
32+
set mode spawn
33+
}
34+
2835
if {$mode eq "pipe"} {
2936
test_pipe
3037
} else {
3138
test_spawn
3239
}
40+
puts [string cat "mode: " $mode " OK"]

0 commit comments

Comments
 (0)