mirror of
https://github.com/zhigang1992/create-react-app.git
synced 2026-04-24 05:05:53 +08:00
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.
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user