Skip to content

Commit 887fd10

Browse files
rmccuegaearon
authored andcommitted
Print full directory name from lsof (#3440)
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.
1 parent dccc752 commit 887fd10

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/react-dev-utils/getProcessForPort.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ function getProcessCommand(processId, processDirectory) {
5858

5959
function getDirectoryOfProcessById(processId) {
6060
return execSync(
61-
'lsof -p ' + processId + ' | awk \'$4=="cwd" {print $9}\'',
61+
'lsof -p ' + processId + ' | awk \'$4=="cwd" {for (i=9; i<=NF; i++) printf "%s ", $i}\'',
6262
execOptions
6363
).trim();
6464
}

0 commit comments

Comments
 (0)