Skip to content
This repository has been archived by the owner on Sep 25, 2023. It is now read-only.

'pomelo add' always return 'port in use' in Windows: Linux command usage while checking #966

Open
elsemieni opened this issue Jun 29, 2017 · 0 comments

Comments

@elsemieni
Copy link

Hi! :)

When a user wants to add a extra server via Pomelo command line in Windows, it fails to detect usage of port beacuse of usage of non-windows CMD commands (linux netstat and grep) to check it. (pomelo/lib/modules/console.js line 293).

var cmd = 'netstat -tln | grep ';

How to reproduce:

(Tested in windows 10 Pro envoriment, simple server, local).

  • Start a pomelo server (in this case pomelo-tutorial).
  • Add an extra server via pomelo command line.

pomelo add host=127.0.0.1 port=8000 clientPort=90000 frontend=true serverType=connector id=added-connector-server-1

Expected result:

A server added to master server list.

Actual result:

{ message: 'Port occupied already, check your server to add.', stack: 'Error: Port occupied already, check your server to add.\n at ...\\node_modules\\pomelo\\lib\\modules\\console.js:360:32\ n at Object.utils.invokeCallback (...\\node_modules\\pomelo\\lib\\util\\utils.js:21:14)\n at ...\\node_modules\\pomelo\\lib\\modules\\console.js:300:13\n at ChildProcess.exithandler (child_process.js:220:5)\n at emitTwo (events.js:87:13)\n at ChildPro cess.emit (events.js:172:7)\n at maybeClose (internal/child_process.js:829:16)\n at Process.__dirname._handle.onexit (internal/child_process.js:211:5)' }

A workaround is to bypass port checking or replace with a windows-compatible command, and replacing output criteria.

Thanks in advance :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant