Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
my $init-cwd = $*CWD.add("tmp");
mkdir $init-cwd;
my @paths-to-use = (1..100).map({ "{$init-cwd}/$_".IO });
mkdir $_ for @paths-to-use;
@paths-to-use.hyper(:batch(1)).map: {
my $rel-path = $_.relative($init-cwd);
say $rel-path;
die "weird path: {$rel-path}" if $rel-path.starts-with('.');
react {
my $proc = Proc::Async.new("echo", $rel-path);
whenever $proc.start(:cwd($_)) { sink $_ }
}
}
1
1
2
3
2
3
5
5
6
5
5
6
8
7
9
7
8
9
10
11
10
12
11
12
13
14
15
13
14
15
16
17
16
17
18
19
18
20
19
20
22
21
23
21
22
23
25
24
26
25
24
28
27
26
27
29
28
29
30
31
30
31
32
34
34
32
34
34
35
36
37
35
36
37
../38
39
40
39
40
A worker in a parallel iteration (hyper or race) initiated here:
in block <unit> at relpath.raku line 7
Died at:
weird path: ../38
in block at relpath.raku line 10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment