On Sat, Feb 14, 2015 at 1:02 AM, James E Keenan via RT < perlbug-followup@perl.org> wrote: > On Fri Feb 13 15:40:38 2015, LeonT wrote: > > On Mon, Feb 9, 2015 at 10:56 PM, via RT <perlbug-followup@perl.org> > > wrote: > > > > > The original problem which led me to this was: > > > > > > system "ps","-p",$$,"-o","pid,etime,bsdtime,c,rss"; # always shows > > > wrong values > > > > > > The problem appears to be that $$ is not correct when passed to > > > system(). > > > I'm guessing it evaluates to the pid of an internaly-created child > > > process. > > > > > > Can 'system' (and any other forking operators) be made to > > > evaluate their arguments *before* forking? > > > > > > #!/usr/bin/perl > > > use strict; use warnings; > > > > > > my $copy_of_pid = $$; > > > print "Perl process is $$\n"; > > > > > > system "/bin/echo", 'echo: $$ =', $$; > > > system "/bin/echo", 'echo: $copy_of_pid =', $copy_of_pid; > > > > > > > Fix attached. > > > > Leon > > In the parts of the patch where you are adding lines to source code or > tests, could you use space characters rather than hard-tabs for leading > whitespace, so as to make the appearance tidier? > Perl's source consistently uses a convention of tabstop=8 and soft-tabstop=4, which is like "indent 4 spaces, but replace every 8 spaces with a tab". I'm quite sure space- and tab-lovers alike are not particularly fond of this mixed use whitespace, but it's a bit late to change that for the entire codebase. I had actually paid attention to be consistent (the testfile doesn't have a modeline). LeonThread Previous | Thread Next