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.

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

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

lstewart updated this revision to Diff 22250.Nov 16 2016, 9:20 AM
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.
imp accepted this revision.Nov 16 2016, 3:15 PM
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 accepted this revision.Nov 16 2016, 3:51 PM
kib edited edge metadata.

We have working C99 bool type.

lstewart updated this revision to Diff 22272.Nov 17 2016, 4:48 AM
lstewart edited edge metadata.
lstewart removed rS FreeBSD src repository as the repository for this revision.

@kib: You prefer this?

This revision now requires review to proceed.Nov 17 2016, 4:48 AM
kib accepted this revision.Nov 17 2016, 9:30 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.