Page MenuHomeFreeBSD

Suppress emission of delimiter after final PID when using pgrep's -d switch
ClosedPublic

Authored by lstewart on Nov 16 2016, 9:20 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Nov 22, 7:49 AM
Unknown Object (File)
Oct 19 2024, 1:42 PM
Unknown Object (File)
Oct 11 2024, 8:45 PM
Unknown Object (File)
Oct 8 2024, 1:38 PM
Unknown Object (File)
Oct 8 2024, 1:38 PM
Unknown Object (File)
Oct 8 2024, 1:38 PM
Unknown Object (File)
Oct 8 2024, 1:38 PM
Unknown Object (File)
Oct 8 2024, 1:07 PM
Subscribers

Details

Summary

pgrep naively appends the delimiter to all PIDs including the last. e.g. "pgrep -d, getty" outputs "1399,1386,1309,1308,1307,1306,1305,1302,"
Ensure the list is correctly delimited by suppressing the emission of the delimiter after the final PID.

Sponsored by: Netflix, Inc.

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

lstewart retitled this revision from to Suppress emission of delimiter after final PID when using pgrep's -d switch.
lstewart updated this object.
lstewart edited the test plan for this revision. (Show Details)
lstewart added a reviewer: kib.
lstewart set the repository for this revision to rS FreeBSD src repository - subversion.
imp added a reviewer: imp.

Lots of ways to skin this cat, this is as good as any other.

This revision is now accepted and ready to land.Nov 16 2016, 3:15 PM
kib edited edge metadata.

We have working C99 bool type.

lstewart edited edge metadata.
lstewart removed rS FreeBSD src repository - subversion as the repository for this revision.

@kib: You prefer this?

This revision now requires review to proceed.Nov 17 2016, 4:48 AM
kib edited edge metadata.

As a very minimal start, yes. You may consider changing the return type of action to bool and do the necessary cascade of related changes.

This revision is now accepted and ready to land.Nov 17 2016, 9:30 AM
This revision was automatically updated to reflect the committed changes.