Skip to content

Commit

Permalink
Print full directory name from lsof (facebook#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 Pavel Zhytko committed Jul 10, 2018
1 parent a56cfdd commit 0affd35
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 0affd35

Please sign in to comment.