File tree Expand file tree Collapse file tree 1 file changed +27
-1
lines changed Expand file tree Collapse file tree 1 file changed +27
-1
lines changed Original file line number Diff line number Diff line change 1
1
use v6 ;
2
2
use Test ;
3
+ use lib ' t/spec/packages' ;
4
+ use Test ::Util;
3
5
4
- plan 6 ;
6
+ plan 8 ;
5
7
6
8
my $ filename = $ * TMPDIR ~ ' /tmp.' ~ $ * PID ~ ' -' ~ time ;
7
9
@@ -14,3 +16,27 @@ my $rfh = await start { open($filename, :r) };
14
16
is $ rfh . get , ' abc' , ' Can read handle in main thread opened in another thread' ;
15
17
is (await start $ rfh . get ), ' def' , ' Can read handle on thread pool' ;
16
18
lives-ok { $ rfh . close }, ' Can close handle on main thread after opening on another thread' ;
19
+
20
+ is_run(' await start { say $*IN.get.uc for ^3 }' ,
21
+ " foo\n bar\n baz\n " ,
22
+ {
23
+ status => 0 ,
24
+ out => " FOO\n BAR\n BAZ\n " ,
25
+ err => " " ,
26
+ },
27
+ ' reading from $*IN from another thread works (file)' );
28
+
29
+ # RT #124005
30
+ {
31
+ my $ temp-file = ' handle-between-threads-' ~ $ * PID ;
32
+ spurt $ temp-file , " foo" ;
33
+ LEAVE unlink $ temp-file ;
34
+
35
+ my $ cat = $ * DISTRO . is-win ?? ' type' !! ' cat' ;
36
+ my $ quote = $ * DISTRO . is-win ?? ' "' !! " '" ;
37
+ my $ proc = shell (
38
+ Q :s " $cat $temp-file | $*EXECUTABLE -e $quote await start { say get().uc } $quote " ,
39
+ : out);
40
+ is $ proc . out. get , " FOO" , ' reading from $*IN from another thread works (pipe)' ;
41
+ so $ proc . out. close ;
42
+ }
You can’t perform that action at this time.
0 commit comments