From 7c9e253a2f76c71a4d799245a00d2238bcf950c9 Mon Sep 17 00:00:00 2001 From: Zhou Peng Date: Wed, 3 Mar 2021 18:58:48 +0800 Subject: [PATCH] Update getProcessForPort.js --- packages/react-dev-utils/getProcessForPort.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/react-dev-utils/getProcessForPort.js b/packages/react-dev-utils/getProcessForPort.js index 8df45464977..3094b839ee4 100644 --- a/packages/react-dev-utils/getProcessForPort.js +++ b/packages/react-dev-utils/getProcessForPort.js @@ -9,6 +9,7 @@ var chalk = require('chalk'); var execSync = require('child_process').execSync; +var execFileSync = require('child_process').execFileSync; var path = require('path'); var execOptions = { @@ -25,7 +26,7 @@ function isProcessAReactApp(processCommand) { } function getProcessIdOnPort(port) { - return execSync('lsof -i:' + port + ' -P -t -sTCP:LISTEN', execOptions) + return execFileSync('lsof', ['-i:'+port, '-P', '-t', '-sTCP:LISTEN'], execOptions) .split('\n')[0] .trim(); }