From 34e671b98575ba7686ea6eaec6678193c61c4956 Mon Sep 17 00:00:00 2001 From: Schnitzbauer Date: Sun, 2 Sep 2018 00:19:32 +0200 Subject: [PATCH 1/2] extract current working directory more robustly --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 84eab9d..d4fcb1f 100644 --- a/index.js +++ b/index.js @@ -160,7 +160,7 @@ const setCwd = (pid, action) => { } } } else { - exec(`lsof -p ${pid} | awk '$4=="cwd"' | tr -s ' ' | cut -d ' ' -f9-`, (err, stdout) => { + exec(`lsof -a -F -p ${pid} -d cwd | grep ^n | cut -c2-`, (err, stdout) => { cwd = stdout.trim(); setGit(cwd); }); From 1ea3cab0665bdd7f5496234e7c5cd70790a74fc1 Mon Sep 17 00:00:00 2001 From: Joerg Schnitzbauer Date: Sun, 2 Sep 2018 00:42:19 +0200 Subject: [PATCH 2/2] extract current working directory more robustly --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 84eab9d..d4fcb1f 100644 --- a/index.js +++ b/index.js @@ -160,7 +160,7 @@ const setCwd = (pid, action) => { } } } else { - exec(`lsof -p ${pid} | awk '$4=="cwd"' | tr -s ' ' | cut -d ' ' -f9-`, (err, stdout) => { + exec(`lsof -a -F -p ${pid} -d cwd | grep ^n | cut -c2-`, (err, stdout) => { cwd = stdout.trim(); setGit(cwd); });