Various ‘macOS’-oriented Tools and Utilities
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

22 lines
426 B

#' Retrieve kernel state information
#'
#' @export
kernel_state <- function() {
res <- sys::exec_internal("sysctl", "-a")
if (res$status != 0) {
stop("Error retrieving kernel state info. Are you on macOS?", call.=FALSE)
}
out <- rawToChar(res$stdout)
purrr::map_df(strsplit(out, "\n")[[1]], ~{
.x <- strsplit(.x, ": ", fixed = TRUE)[[1]]
list(
setting = .x[1],
value = .x[2]
)
})
}