I wrote this test program:
await Promise.anyof(
Promise.allof((^5).map: {start { sleep 10; say "done $_" } }),
Promise.in(5).then: { say 'ouch' }
);
sleep 10;
When the second promise times out it prints 'ouch' and the await exits, but the first promise's code block is still running. After five more seconds its five processes end and print 'done':
$ ./test1.p6
ouch
done 0
done 1
done 2
done 3
done 4
I tried to terminate the first promise assigning it to a variable and then calling the .break method from the second promise, but it doesn't work.
Is there a way to kill the first promise and the other five sub-promises it started?