From f5df507d2d368dbaeaa18a2d7a98d9b68ce68a17 Mon Sep 17 00:00:00 2001 From: Rasmus Eneman Date: Sun, 17 Sep 2017 00:22:06 +0200 Subject: [PATCH] Display pid in already running message (#3131) Fixes #3106 --- packages/react-dev-utils/getProcessForPort.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/react-dev-utils/getProcessForPort.js b/packages/react-dev-utils/getProcessForPort.js index 428dc62cfda..73a445f5b7a 100644 --- a/packages/react-dev-utils/getProcessForPort.js +++ b/packages/react-dev-utils/getProcessForPort.js @@ -48,9 +48,11 @@ function getProcessCommand(processId, processDirectory) { execOptions ); + command = command.replace(/\n$/, '') + if (isProcessAReactApp(command)) { const packageName = getPackageNameInDirectory(processDirectory); - return packageName ? packageName + '\n' : command; + return packageName ? packageName : command; } else { return command; } @@ -68,7 +70,8 @@ function getProcessForPort(port) { var processId = getProcessIdOnPort(port); var directory = getDirectoryOfProcessById(processId); var command = getProcessCommand(processId, directory); - return chalk.cyan(command) + chalk.blue(' in ') + chalk.cyan(directory); + return chalk.cyan(command) + chalk.grey(' (pid ' + processId + ')\n') + + chalk.blue(' in ') + chalk.cyan(directory); } catch (e) { return null; }