Skip to content

Commit

Permalink
Print full directory name from lsof (#3440)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
rmccue authored and gaearon committed Jan 9, 2018
1 parent dccc752 commit 887fd10
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/react-dev-utils/getProcessForPort.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down

0 comments on commit 887fd10

Please sign in to comment.