From 0ae99e5d20d437780ce00d2bfd92b9694e480af5 Mon Sep 17 00:00:00 2001 From: Ryan McCue Date: Sat, 11 Nov 2017 13:43:17 +1000 Subject: [PATCH] Print full directory name from lsof awk splits lines based on spaces, which causes directory names with spaces to end up in other fields. Using a for loop allows us to print from the 9th field onwards instead of just the 9th field. --- packages/react-dev-utils/getProcessForPort.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-dev-utils/getProcessForPort.js b/packages/react-dev-utils/getProcessForPort.js index 932f3e5bf4d..f9eda7752b4 100644 --- a/packages/react-dev-utils/getProcessForPort.js +++ b/packages/react-dev-utils/getProcessForPort.js @@ -58,7 +58,7 @@ function getProcessCommand(processId, processDirectory) { function getDirectoryOfProcessById(processId) { return execSync( - 'lsof -p ' + processId + ' | awk \'$4=="cwd" {print $9}\'', + 'lsof -p ' + processId + ' | awk \'$4=="cwd" {for (i=9; i<=NF; i++) printf "%s ", $i}\'', execOptions ).trim(); }