siadat/ptail
view stdout/stderr of a process
ptail (process tail) is a simple tool for viewing the stdout and stderr of a process. Think of it as tail -f for the output of other processes.
There are two ways to use ptail (similar to strace): ptail a new process (with a given program), or ptail an exiting process (with PID).
# new process
./zig-out/bin/ptail PROGRAM [ARGS...]
# exiting process
sudo ./zig-out/bin/ptail -p PID
zig build test
with .test_server_mode captures stdout and stderr of processes and does not show them until the end of tests.
If a test is blocked, nothing is shown and you cannot do printf debugging. You can use the following command to see the output of the tests as they are running:./zig-out/bin/ptail /usr/bin/bash -c 'zig build test'
sudo ./zig-out/bin/ptail -p $(ps -C "zls" -o pid= | head -1)
./zig-out/bin/ptail /usr/bin/bash -c 'ping localhost > /dev/null'
# terminal 1
ping localhost > /dev/null
# terminal 2
sudo ./zig-out/bin/ptail -p $(ps -C "ping" -o pid= | head -1)
64 bytes from localhost (::1): icmp_seq=1 ttl=64 time=0.058 ms
64 bytes from localhost (::1): icmp_seq=2 ttl=64 time=0.067 ms
...
zig build
zig build test