aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/os/process.c
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2018-03-14 23:26:37 +0100
committerJustin M. Keyes <justinkz@gmail.com>2018-03-16 10:55:12 +0100
commit12af7016e23e7b7f507dc99a1b73e64d0bb5ccf3 (patch)
tree1a62ca6d82a3ab67784442c3115b215b898ab17c /src/nvim/os/process.c
parentdbad797edd4636f830abd7ade1138a1a27ac30d2 (diff)
downloadrneovim-12af7016e23e7b7f507dc99a1b73e64d0bb5ccf3.tar.gz
rneovim-12af7016e23e7b7f507dc99a1b73e64d0bb5ccf3.tar.bz2
rneovim-12af7016e23e7b7f507dc99a1b73e64d0bb5ccf3.zip
nvim_get_proc_children: fallback to shell
/proc/…/children may be unavailable because of an unset kernel option. Fallback to `pgrep` invoked in a shell.
Diffstat (limited to 'src/nvim/os/process.c')
-rw-r--r--src/nvim/os/process.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/nvim/os/process.c b/src/nvim/os/process.c
index da66d78e0d..80c2dad64d 100644
--- a/src/nvim/os/process.c
+++ b/src/nvim/os/process.c
@@ -2,6 +2,7 @@
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
#include <uv.h> // for HANDLE (win32)
+
#ifdef WIN32
# include <tlhelp32.h> // for CreateToolhelp32Snapshot
#endif
@@ -165,7 +166,7 @@ int os_proc_children(int ppid, int **proc_list, size_t *proc_count)
snprintf(proc_p, sizeof(proc_p), "/proc/%d/task/%d/children", ppid, ppid);
FILE *fp = fopen(proc_p, "r");
if (fp == NULL) {
- return 1; // Process not found.
+ return 2; // Process not found, or /proc/…/children not supported.
}
int match_pid;
while (fscanf(fp, "%d", &match_pid) > 0) {