/usr/share/gap/pkg/io/example/popen2.g is in gap-io 4.5.1+ds-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | # Pipes some megabytes through /bin/cat:
LoadPackage("io");
s := "Max";
for i in [1..25] do Append(s,s); od;
Print("Have string of length ",Length(s),".\n");
p := IO_Popen2("/bin/cat",[]);
IO_SendStringBackground(p.stdin,s);
# We want that /bin/cat terminates after the child has sent everything:
IO_Close(p.stdin);
t := IO_ReadUntilEOF(p.stdout);
IO_Close(p.stdout);
Print("Have read string!\n");
if s <> t then
Print("Alert: Received string not identical to original one!\n");
fi;
|