Skip to content

Possible PR: ps_is_alive() #205

@dansmith01

Description

@dansmith01

I'm adding a ps_is_alive() for my own package, and was wondering if you'd consider a PR here.

It caught me by surprise when ps_is_running() returned FALSE for a sleeping process on Linux. I know now that this is documented and expected behavior, but it still left me needing a way to determine if a process was in any of the alive states described by ps_status().

ps_is_alive <- function(p = ps_handle()) {
  assert_ps_handle(p)
  alive <- c("idle", "running", "sleeping", "disk_sleep", "uninterruptible", "waking")
  isTRUE(try(silent = TRUE, ps_status(p) %in% alive))
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions