fork download
  1. #!/usr/bin/perl6
  2. # your code goes here
  3.  
  4. my \bash = Proc::Async.new: "/usr/bin/env", "bash", :w;
  5.  
  6. react {
  7. whenever bash.stdout.lines {
  8. .say;
  9. }
  10. whenever bash.start { }
  11. whenever $*IN.lines {
  12. bash.say("$_");
  13. bash.close-stdin if $_ eq "exit";
  14. }
  15. }
Success #stdin #stdout 0.27s 114104KB
stdin
ls -al
pwd
exit
stdout
total 12
drwxr-x--- 2 root 1000 4096 May 23 08:43 .
drwxr-xr-x 3 root root 4096 May 23 08:43 ..
-rw-rw-r-- 1 root root  253 May 23 08:43 prog.pl
/home/6tuT5x