From 626c8d0065edeb8dbd3d20c1f01fcaf5938503db Mon Sep 17 00:00:00 2001 From: Ian McNally Date: Sat, 1 Oct 2016 13:56:24 -0400 Subject: [PATCH 01/15] add logging of existing port process on start --- packages/react-scripts/scripts/start.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/packages/react-scripts/scripts/start.js b/packages/react-scripts/scripts/start.js index 8723c281637..ca4db3690e8 100644 --- a/packages/react-scripts/scripts/start.js +++ b/packages/react-scripts/scripts/start.js @@ -18,6 +18,7 @@ process.env.NODE_ENV = 'development'; require('dotenv').config({silent: true}); var chalk = require('chalk'); +var execSync = require('child_process').execSync; var webpack = require('webpack'); var WebpackDevServer = require('webpack-dev-server'); var historyApiFallback = require('connect-history-api-fallback'); @@ -258,6 +259,17 @@ function run(port) { runDevServer(host, port, protocol); } +function getProcessNameOnPort(port) { + var command = 'ps -o command -p "$(lsof -i:' + port + ' -P -t)" | sed -n 2p | tr -d "\n"'; + var execOptions = { encoding: 'utf8' }; + + try { + return execSync(command, execOptions); + } catch(e) { + return null; + } +} + // We attempt to use the default port but if it is busy, we offer the user to // run on a different port. `detect()` Promise resolves to the next free port. detect(DEFAULT_PORT).then(port => { @@ -267,8 +279,11 @@ detect(DEFAULT_PORT).then(port => { } clearConsole(); + var existingProcess = getProcessNameOnPort(DEFAULT_PORT); var question = - chalk.yellow('Something is already running on port ' + DEFAULT_PORT + '.') + + chalk.yellow('Something ' + + ((existingProcess) ? '(probably: ' + existingProcess +') ' : '') + + 'is already running on port ' + DEFAULT_PORT + '.') + '\n\nWould you like to run the app on another port instead?'; prompt(question, true).then(shouldChangePort => { From dc824f51464863a75162e51138f8de69eb9eabb5 Mon Sep 17 00:00:00 2001 From: Ian McNally Date: Sun, 2 Oct 2016 17:07:56 -0400 Subject: [PATCH 02/15] Move port process wording in start command on to next line --- packages/react-scripts/scripts/start.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/react-scripts/scripts/start.js b/packages/react-scripts/scripts/start.js index ca4db3690e8..8d1c23b59b4 100644 --- a/packages/react-scripts/scripts/start.js +++ b/packages/react-scripts/scripts/start.js @@ -281,10 +281,9 @@ detect(DEFAULT_PORT).then(port => { clearConsole(); var existingProcess = getProcessNameOnPort(DEFAULT_PORT); var question = - chalk.yellow('Something ' + - ((existingProcess) ? '(probably: ' + existingProcess +') ' : '') + - 'is already running on port ' + DEFAULT_PORT + '.') + - '\n\nWould you like to run the app on another port instead?'; + chalk.yellow('Something is already running on port ' + DEFAULT_PORT + '.' + + ((existingProcess) ? ' Probably:\n ' + existingProcess : '')) + + '\n\nWould you like to run the app on another port instead?'; prompt(question, true).then(shouldChangePort => { if (shouldChangePort) { From abeca8a8ce3ba5d3696fea64fc60457e70f23d56 Mon Sep 17 00:00:00 2001 From: Ian McNally Date: Tue, 4 Oct 2016 10:18:13 -0400 Subject: [PATCH 03/15] Color the named processes as cyan in terminal output --- packages/react-scripts/scripts/start.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-scripts/scripts/start.js b/packages/react-scripts/scripts/start.js index 8d1c23b59b4..0c3f5debdb0 100644 --- a/packages/react-scripts/scripts/start.js +++ b/packages/react-scripts/scripts/start.js @@ -282,7 +282,7 @@ detect(DEFAULT_PORT).then(port => { var existingProcess = getProcessNameOnPort(DEFAULT_PORT); var question = chalk.yellow('Something is already running on port ' + DEFAULT_PORT + '.' + - ((existingProcess) ? ' Probably:\n ' + existingProcess : '')) + + ((existingProcess) ? ' Probably:\n ' + chalk.cyan(existingProcess) : '')) + '\n\nWould you like to run the app on another port instead?'; prompt(question, true).then(shouldChangePort => { From c08a9e128950612bfa4e3174c3d9420c39590885 Mon Sep 17 00:00:00 2001 From: Ian McNally Date: Tue, 4 Oct 2016 10:19:59 -0400 Subject: [PATCH 04/15] Add handling for multiple processes on a part - With the currently process filtering, if multiple processes are returned as running on port 3000, this command would fail. This splits apart the process IDing and the process naming, to support multiple processes. - One curious thing about the bash command to get processes, is that it'll include browsers with a window open on localhost:3000. May want to reconsider that. --- packages/react-scripts/scripts/start.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/react-scripts/scripts/start.js b/packages/react-scripts/scripts/start.js index 0c3f5debdb0..618fda87cb9 100644 --- a/packages/react-scripts/scripts/start.js +++ b/packages/react-scripts/scripts/start.js @@ -260,11 +260,18 @@ function run(port) { } function getProcessNameOnPort(port) { - var command = 'ps -o command -p "$(lsof -i:' + port + ' -P -t)" | sed -n 2p | tr -d "\n"'; var execOptions = { encoding: 'utf8' }; + var processesCommand = 'lsof -i:' + port + ' -P -t' try { - return execSync(command, execOptions); + var processIds = execSync(processesCommand, execOptions).match(/(\S+)/g); + + var namedProcesses = processIds.map(function(processId) { + var command = 'ps -o command -p ' + processId + ' | sed -n 2p | tr -d "\n"'; + return execSync(command, execOptions); + }); + + return namedProcesses.join(',\n '); } catch(e) { return null; } From e8d0053b297343f610b7905fb1261e887b916e36 Mon Sep 17 00:00:00 2001 From: Ian McNally Date: Thu, 6 Oct 2016 11:05:31 -0400 Subject: [PATCH 05/15] Add process directory to existing port warning - also moved terminal coloring up, when getting the process, to be able to distinguish the process command from the directory --- packages/react-scripts/scripts/start.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/react-scripts/scripts/start.js b/packages/react-scripts/scripts/start.js index 618fda87cb9..f2a6acc7bf3 100644 --- a/packages/react-scripts/scripts/start.js +++ b/packages/react-scripts/scripts/start.js @@ -261,17 +261,17 @@ function run(port) { function getProcessNameOnPort(port) { var execOptions = { encoding: 'utf8' }; - var processesCommand = 'lsof -i:' + port + ' -P -t' try { - var processIds = execSync(processesCommand, execOptions).match(/(\S+)/g); + var processIds = execSync('lsof -i:' + port + ' -P -t', execOptions).match(/(\S+)/g); - var namedProcesses = processIds.map(function(processId) { - var command = 'ps -o command -p ' + processId + ' | sed -n 2p | tr -d "\n"'; - return execSync(command, execOptions); + var processCommandsAndDirectories = processIds.map(function(processId) { + var processCommand = execSync('ps -o command -p ' + processId + ' | sed -n 2p', execOptions); + var processDirectory = execSync('lsof -p '+ processId + ' | grep cwd | awk \'{print " in " $9}\'', execOptions); + return chalk.blue(processCommand) + chalk.cyan(processDirectory); }); - return namedProcesses.join(',\n '); + return processCommandsAndDirectories.join('\n '); } catch(e) { return null; } @@ -289,7 +289,7 @@ detect(DEFAULT_PORT).then(port => { var existingProcess = getProcessNameOnPort(DEFAULT_PORT); var question = chalk.yellow('Something is already running on port ' + DEFAULT_PORT + '.' + - ((existingProcess) ? ' Probably:\n ' + chalk.cyan(existingProcess) : '')) + + ((existingProcess) ? ' Probably:\n ' + existingProcess : '')) + '\n\nWould you like to run the app on another port instead?'; prompt(question, true).then(shouldChangePort => { From e3dcaaf41dcb87dd164dc9aefd1306e7f067bff7 Mon Sep 17 00:00:00 2001 From: Ian McNally Date: Thu, 6 Oct 2016 18:24:02 -0400 Subject: [PATCH 06/15] Change output color to all cyan, except "in" --- packages/react-scripts/scripts/start.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/react-scripts/scripts/start.js b/packages/react-scripts/scripts/start.js index f2a6acc7bf3..d55ca05e546 100644 --- a/packages/react-scripts/scripts/start.js +++ b/packages/react-scripts/scripts/start.js @@ -267,8 +267,8 @@ function getProcessNameOnPort(port) { var processCommandsAndDirectories = processIds.map(function(processId) { var processCommand = execSync('ps -o command -p ' + processId + ' | sed -n 2p', execOptions); - var processDirectory = execSync('lsof -p '+ processId + ' | grep cwd | awk \'{print " in " $9}\'', execOptions); - return chalk.blue(processCommand) + chalk.cyan(processDirectory); + var processDirectory = execSync('lsof -p '+ processId + ' | grep cwd | awk \'{print $9}\'', execOptions); + return chalk.cyan(processCommand) + chalk.blue(' in ') + chalk.cyan(processDirectory); }); return processCommandsAndDirectories.join('\n '); From 9c2e3aa0b8b52445288deefbcaea0e66f0793555 Mon Sep 17 00:00:00 2001 From: Ian McNally Date: Thu, 6 Oct 2016 18:28:23 -0400 Subject: [PATCH 07/15] Rename getProcessNameOnPort -> getProcessForPort - better reflects its broadened scope (both command and directory) --- packages/react-scripts/scripts/start.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/react-scripts/scripts/start.js b/packages/react-scripts/scripts/start.js index d55ca05e546..14583b29ca7 100644 --- a/packages/react-scripts/scripts/start.js +++ b/packages/react-scripts/scripts/start.js @@ -259,7 +259,7 @@ function run(port) { runDevServer(host, port, protocol); } -function getProcessNameOnPort(port) { +function getProcessForPort(port) { var execOptions = { encoding: 'utf8' }; try { @@ -286,7 +286,7 @@ detect(DEFAULT_PORT).then(port => { } clearConsole(); - var existingProcess = getProcessNameOnPort(DEFAULT_PORT); + var existingProcess = getProcessForPort(DEFAULT_PORT); var question = chalk.yellow('Something is already running on port ' + DEFAULT_PORT + '.' + ((existingProcess) ? ' Probably:\n ' + existingProcess : '')) + From 52e70f471a36d20e24a1a18c2c264d94a13da132 Mon Sep 17 00:00:00 2001 From: Ian McNally Date: Tue, 11 Oct 2016 17:25:14 -0400 Subject: [PATCH 08/15] Add checking if process is a CRA instance, to customize port running message - moved from using package.json to a regex, for reliability --- packages/react-scripts/scripts/start.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/react-scripts/scripts/start.js b/packages/react-scripts/scripts/start.js index 14583b29ca7..fbc12055ae2 100644 --- a/packages/react-scripts/scripts/start.js +++ b/packages/react-scripts/scripts/start.js @@ -259,6 +259,10 @@ function run(port) { runDevServer(host, port, protocol); } +function isProcessAReactApp(processCommand) { + return /^node .*react-scripts\/scripts\/start\.js\s?$/.test(processCommand); +} + function getProcessForPort(port) { var execOptions = { encoding: 'utf8' }; @@ -267,6 +271,9 @@ function getProcessForPort(port) { var processCommandsAndDirectories = processIds.map(function(processId) { var processCommand = execSync('ps -o command -p ' + processId + ' | sed -n 2p', execOptions); + if (isProcessAReactApp(processCommand)) { + processCommand = 'create-react-app\n'; + } var processDirectory = execSync('lsof -p '+ processId + ' | grep cwd | awk \'{print $9}\'', execOptions); return chalk.cyan(processCommand) + chalk.blue(' in ') + chalk.cyan(processDirectory); }); From 85e8151625a2c224adf24b43b2216d48381b383d Mon Sep 17 00:00:00 2001 From: Ian McNally Date: Wed, 12 Oct 2016 14:43:34 -0400 Subject: [PATCH 09/15] Move getProcessForPort to react-dev-utils - also allowed for breakdown of commands into helper methods --- packages/react-dev-utils/getProcessForPort.js | 40 +++++++++++++++++++ packages/react-scripts/scripts/start.js | 27 +------------ 2 files changed, 41 insertions(+), 26 deletions(-) create mode 100644 packages/react-dev-utils/getProcessForPort.js diff --git a/packages/react-dev-utils/getProcessForPort.js b/packages/react-dev-utils/getProcessForPort.js new file mode 100644 index 00000000000..910053446ce --- /dev/null +++ b/packages/react-dev-utils/getProcessForPort.js @@ -0,0 +1,40 @@ +var chalk = require('chalk'); +var execSync = require('child_process').execSync; + +var execOptions = { encoding: 'utf8' }; + +function isProcessAReactApp(processCommand) { + return /^node .*react-scripts\/scripts\/start\.js\s?$/.test(processCommand); +} + +function getProcessIdsOnPort(port) { + return execSync('lsof -i:' + port + ' -P -t', execOptions).match(/(\S+)/g); +} + +function getProcessCommandById(processId) { + var command = execSync('ps -o command -p ' + processId + ' | sed -n 2p', execOptions); + return (isProcessAReactApp(command)) ? 'create-react-app\n' : command; +} + +function getDirectoryOfProcessById(processId) { + return execSync('lsof -p '+ processId + ' | grep cwd | awk \'{print $9}\'', execOptions); +} + +function getProcessForPort(port) { + try { + var processIds = getProcessIdsOnPort(port); + + var processCommandsAndDirectories = processIds.map(function(processId) { + var command = getProcessCommandById(processId); + var directory = getDirectoryOfProcessById(processId); + return chalk.cyan(command) + chalk.blue(' in ') + chalk.cyan(directory); + }); + + return processCommandsAndDirectories.join('\n '); + } catch(e) { + return null; + } +} + +module.exports = getProcessForPort; + diff --git a/packages/react-scripts/scripts/start.js b/packages/react-scripts/scripts/start.js index fbc12055ae2..d9dbee286ac 100644 --- a/packages/react-scripts/scripts/start.js +++ b/packages/react-scripts/scripts/start.js @@ -18,7 +18,6 @@ process.env.NODE_ENV = 'development'; require('dotenv').config({silent: true}); var chalk = require('chalk'); -var execSync = require('child_process').execSync; var webpack = require('webpack'); var WebpackDevServer = require('webpack-dev-server'); var historyApiFallback = require('connect-history-api-fallback'); @@ -27,6 +26,7 @@ var detect = require('detect-port'); var clearConsole = require('react-dev-utils/clearConsole'); var checkRequiredFiles = require('react-dev-utils/checkRequiredFiles'); var formatWebpackMessages = require('react-dev-utils/formatWebpackMessages'); +var getProcessForPort = require('react-dev-utils/getProcessForPort'); var openBrowser = require('react-dev-utils/openBrowser'); var prompt = require('react-dev-utils/prompt'); var config = require('../config/webpack.config.dev'); @@ -259,31 +259,6 @@ function run(port) { runDevServer(host, port, protocol); } -function isProcessAReactApp(processCommand) { - return /^node .*react-scripts\/scripts\/start\.js\s?$/.test(processCommand); -} - -function getProcessForPort(port) { - var execOptions = { encoding: 'utf8' }; - - try { - var processIds = execSync('lsof -i:' + port + ' -P -t', execOptions).match(/(\S+)/g); - - var processCommandsAndDirectories = processIds.map(function(processId) { - var processCommand = execSync('ps -o command -p ' + processId + ' | sed -n 2p', execOptions); - if (isProcessAReactApp(processCommand)) { - processCommand = 'create-react-app\n'; - } - var processDirectory = execSync('lsof -p '+ processId + ' | grep cwd | awk \'{print $9}\'', execOptions); - return chalk.cyan(processCommand) + chalk.blue(' in ') + chalk.cyan(processDirectory); - }); - - return processCommandsAndDirectories.join('\n '); - } catch(e) { - return null; - } -} - // We attempt to use the default port but if it is busy, we offer the user to // run on a different port. `detect()` Promise resolves to the next free port. detect(DEFAULT_PORT).then(port => { From 29be9d65028b13530666cbbddfad020d627c506e Mon Sep 17 00:00:00 2001 From: Ian McNally Date: Wed, 12 Oct 2016 14:51:25 -0400 Subject: [PATCH 10/15] Add documentation for getProcessForPort --- packages/react-dev-utils/README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/packages/react-dev-utils/README.md b/packages/react-dev-utils/README.md index 14c69493e5a..2d7ff38f081 100644 --- a/packages/react-dev-utils/README.md +++ b/packages/react-dev-utils/README.md @@ -142,6 +142,22 @@ compiler.plugin('done', function(stats) { }); ``` +#### `getProcessForPort(port: number): string` + +Finds the currently running process(es) on `port`. +Returns a string containing the name and directory, e.g., + +``` +create-react-app +in /Users/developer/create-react-app +``` + +```js +var getProcessForPort = require('react-dev-utils/getProcessForPort'); + +getProcessForPort(3000); +``` + #### `openBrowser(url: string): boolean` Attempts to open the browser with a given URL. From 97e32cacd6c52828e4a617ae6458955f52c76932 Mon Sep 17 00:00:00 2001 From: Ian McNally Date: Wed, 12 Oct 2016 20:35:15 -0400 Subject: [PATCH 11/15] Add getProcessForPort to list of dev-scripts files --- packages/react-dev-utils/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/react-dev-utils/package.json b/packages/react-dev-utils/package.json index 8de715d1916..8b3b6096f56 100644 --- a/packages/react-dev-utils/package.json +++ b/packages/react-dev-utils/package.json @@ -14,6 +14,7 @@ "clearConsole.js", "checkRequiredFiles.js", "formatWebpackMessages.js", + "getProcessForPort.js", "InterpolateHtmlPlugin.js", "openChrome.applescript", "openBrowser.js", From 43fd7bcc15083dcfa51f7038630b4f49699d34e2 Mon Sep 17 00:00:00 2001 From: Ian McNally Date: Wed, 12 Oct 2016 20:50:18 -0400 Subject: [PATCH 12/15] Use app's package name when CRA app is running on another port --- packages/react-dev-utils/getProcessForPort.js | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/packages/react-dev-utils/getProcessForPort.js b/packages/react-dev-utils/getProcessForPort.js index 910053446ce..a44653e458a 100644 --- a/packages/react-dev-utils/getProcessForPort.js +++ b/packages/react-dev-utils/getProcessForPort.js @@ -1,5 +1,6 @@ var chalk = require('chalk'); var execSync = require('child_process').execSync; +var path = require('path'); var execOptions = { encoding: 'utf8' }; @@ -11,9 +12,27 @@ function getProcessIdsOnPort(port) { return execSync('lsof -i:' + port + ' -P -t', execOptions).match(/(\S+)/g); } -function getProcessCommandById(processId) { +function getPackageNameInDirectory(directory) { + var packagePath = path.join(directory.trim(), 'package.json'); + + try { + return require(packagePath).name; + } catch(e) { + return null; + } + +} + +function getProcessCommand(processId, processDirectory) { var command = execSync('ps -o command -p ' + processId + ' | sed -n 2p', execOptions); - return (isProcessAReactApp(command)) ? 'create-react-app\n' : command; + + if (isProcessAReactApp(command)) { + const packageName = getPackageNameInDirectory(processDirectory); + return (packageName) ? packageName + '\n' : command; + } else { + return command; + } + } function getDirectoryOfProcessById(processId) { @@ -25,8 +44,8 @@ function getProcessForPort(port) { var processIds = getProcessIdsOnPort(port); var processCommandsAndDirectories = processIds.map(function(processId) { - var command = getProcessCommandById(processId); var directory = getDirectoryOfProcessById(processId); + var command = getProcessCommand(processId, directory); return chalk.cyan(command) + chalk.blue(' in ') + chalk.cyan(directory); }); From 89ffa37050022aeb7899339d30f432c8edd3c9ac Mon Sep 17 00:00:00 2001 From: Ian McNally Date: Tue, 22 Nov 2016 11:55:49 -0500 Subject: [PATCH 13/15] Filter port process by those listening - Removed the handling of multiple process IDs since you can filtering by listening process (and not have the browser in the list of processes) - Trimmed the terminal outputs for better matching (process id) and better terminal output (directory of process) --- packages/react-dev-utils/getProcessForPort.js | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/packages/react-dev-utils/getProcessForPort.js b/packages/react-dev-utils/getProcessForPort.js index a44653e458a..6441768a2e9 100644 --- a/packages/react-dev-utils/getProcessForPort.js +++ b/packages/react-dev-utils/getProcessForPort.js @@ -8,8 +8,8 @@ function isProcessAReactApp(processCommand) { return /^node .*react-scripts\/scripts\/start\.js\s?$/.test(processCommand); } -function getProcessIdsOnPort(port) { - return execSync('lsof -i:' + port + ' -P -t', execOptions).match(/(\S+)/g); +function getProcessIdOnPort(port) { + return execSync('lsof -i:' + port + ' -P -t -sTCP:LISTEN', execOptions).trim(); } function getPackageNameInDirectory(directory) { @@ -36,20 +36,15 @@ function getProcessCommand(processId, processDirectory) { } function getDirectoryOfProcessById(processId) { - return execSync('lsof -p '+ processId + ' | grep cwd | awk \'{print $9}\'', execOptions); + return execSync('lsof -p '+ processId + ' | grep cwd | awk \'{print $9}\'', execOptions).trim(); } function getProcessForPort(port) { try { - var processIds = getProcessIdsOnPort(port); - - var processCommandsAndDirectories = processIds.map(function(processId) { - var directory = getDirectoryOfProcessById(processId); - var command = getProcessCommand(processId, directory); - return chalk.cyan(command) + chalk.blue(' in ') + chalk.cyan(directory); - }); - - return processCommandsAndDirectories.join('\n '); + var processId = getProcessIdOnPort(port); + var directory = getDirectoryOfProcessById(processId); + var command = getProcessCommand(processId, directory); + return chalk.cyan(command) + chalk.blue(' in ') + chalk.cyan(directory); } catch(e) { return null; } From e25f11374746720bc5eff171507c3690e94fc3bb Mon Sep 17 00:00:00 2001 From: Ian McNally Date: Tue, 22 Nov 2016 12:02:47 -0500 Subject: [PATCH 14/15] Update README on port helpers, to specify only one port returned --- packages/react-dev-utils/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-dev-utils/README.md b/packages/react-dev-utils/README.md index 2d7ff38f081..4d1e6ad3020 100644 --- a/packages/react-dev-utils/README.md +++ b/packages/react-dev-utils/README.md @@ -144,7 +144,7 @@ compiler.plugin('done', function(stats) { #### `getProcessForPort(port: number): string` -Finds the currently running process(es) on `port`. +Finds the currently running process on `port`. Returns a string containing the name and directory, e.g., ``` From 03122b5d719e2c098c05bc3732909be5e1c6c918 Mon Sep 17 00:00:00 2001 From: Ian McNally Date: Tue, 22 Nov 2016 14:24:24 -0500 Subject: [PATCH 15/15] Add ignore of stderr when executing process commands - Make sure any potential errors don't leak to the user --- packages/react-dev-utils/getProcessForPort.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/react-dev-utils/getProcessForPort.js b/packages/react-dev-utils/getProcessForPort.js index 6441768a2e9..5540fbad47a 100644 --- a/packages/react-dev-utils/getProcessForPort.js +++ b/packages/react-dev-utils/getProcessForPort.js @@ -2,7 +2,14 @@ var chalk = require('chalk'); var execSync = require('child_process').execSync; var path = require('path'); -var execOptions = { encoding: 'utf8' }; +var execOptions = { + encoding: 'utf8', + stdio: [ + 'pipe', // stdin (default) + 'pipe', // stdout (default) + 'ignore' //stderr + ] +}; function isProcessAReactApp(processCommand) { return /^node .*react-scripts\/scripts\/start\.js\s?$/.test(processCommand);