-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added getExistingProcesses() #454
Conversation
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at cla@fb.com. Thanks! |
Main concern: Does this work on Windows/Linux? |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
It's another dependency, but |
function getExistingProcesses(port) { | ||
//determine if another process running on the desired port | ||
return new Promise(function (resolve, reject) { | ||
var command = 'lsof -P | grep TCP | grep :' + port + ' | cut -d \' \' -f 1'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lsof
, grep
or cut
is not valid windows commands..
netstat
might be helpful, by requires administrative privileges..
C:\WINDOWS\system32>netstat -aon | findstr 3000
TCP 127.0.0.1:3000 0.0.0.0:0 LISTENING 15564
C:\WINDOWS\system32>tasklist /fi "pid eq 15564"
Image Name PID Session Name Session# Mem Usage
========================= ======== ================ =========== ============
node.exe 15564 Console 5 125.580 K
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also run the second line I mentioned this way you get the entire command that started it instead of just "node". This way we get the entire path of the app running which should be more helpful :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For windows support, let's make it work on one platform and have the infra in place so that someone using windows can chime in and make it work over there with a good user experience!
Hi @millerm, would you be interested in addressing the above comments? |
I’m going to close since this has gotten out of date, and review comments weren’t addressed. |
First attempt at a contribution, addressing issues/441. Added a function to run the unix commands provided by @vjeux. It displays the names of existing processes running on default port in the start script. Tested manually. Eager for critiques and ideas on how to clean it up.
Edit: only made addition for osx