r-lib / ps

R package to query, list, manipulate system processes
https://ps.r-lib.org/
Other
72 stars 18 forks source link

ps_name error #150

Closed flodel closed 8 months ago

flodel commented 9 months ago

Sorry it is difficult to give a reproducible example… I have encountered a situation where ps_name errors out as it evaluates

if(!is.null(cmdline))

The issue is that cmdline is character(0L) at this point, so it dies evaluating if(NA). Please consider changing the line to

if(!is.null(cmdline)) && length(cmdline) > 0L)

?

(I am using version 1.7.4 but see the same code in the current 1.7.5)

gaborcsardi commented 9 months ago

IDK how ps_cmdline() could return an empty vector, but yeah, we can defend against that. Do you want to submit a PR?

flodel commented 9 months ago

Yep, probably this weekend. Thanks.

gaborcsardi commented 8 months ago

Fixed in #152.