http://qs321.pair.com?node_id=11142962


in reply to Re: $0 inconsistency?
in thread $0 inconsistency?

Seems Linux specifc with a 16 byte limit as explained here (Perl 5.14 delta): Assignment to $0 sets the legacy process name with prctl() on Linux

Replies are listed 'Best First'.
Re^3: $0 inconsistency?
by mr_mischief (Monsignor) on Apr 13, 2022 at 18:34 UTC

    Eh... not quite. Setting argv[0] in the process should work on most POSIX systems. That change is an additional thing it does for Linux, and notes the limit for that.

    This is on a Mac.:

    $ perl -e '$0="my really awesome process name"; sleep 60;' & [1] 73413 $ ps PID TTY TIME CMD 70164 ttys002 0:00.05 /opt/local/bin/bash 677 ttys004 0:05.06 /opt/local/bin/bash 73413 ttys004 0:00.03 my really awesome process name