Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
  • Loading branch information
rmccue authored Nov 11, 2017
commit 0ae99e5d20d437780ce00d2bfd92b9694e480af5
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}\'',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Unfortunately, a for loop appears to be the most efficient way to do this; the alternative is to set fields 1-8 to blank strings, but that'd end up less clear as to the intent.)

execOptions
).trim();
}
Expand Down