Skip to content

Conversation

@monkpit
Copy link

@monkpit monkpit commented Dec 8, 2015

Instead of parsing system calls to find an open port, an alternative implementation could use something like the portfinder package to find an open port regardless of the platform we are running on.

I initially referenced this issue in #16 as a niggle over using lsof, which of course doesn't work on Windows. The workaround was to use netstat for a more platform-independent solution, however it still relies upon grep (which will fail on most Windows systems), and the whole situation feels hacky to me.

We can avoid the whole try {systemCall} catch {doWork} pattern if we use something like portfinder.

For a trivial example, see monkpit@db43af5 . I'm sure the error handling could be made much more robust, I'm open to any suggestions 👍 😄

@gnestor gnestor merged commit db43af5 into jupyter:master Dec 8, 2015
@gnestor
Copy link
Contributor

gnestor commented Dec 8, 2015

Much better solution @monkpit! The only issue with your PR was this.kernelGateway was bound to portfinder so that when the notebook is closed and the NotebookEditor class destroyed, the this.kernelGateway.stdin.pause() and this.kernelGateway.kill() were undefined and the process was not killed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants