Skip to content
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

Hide command window when using SSH tunnel on Windows #68

Closed
hfr opened this issue Mar 15, 2012 · 1 comment
Closed

Hide command window when using SSH tunnel on Windows #68

hfr opened this issue Mar 15, 2012 · 1 comment

Comments

@hfr
Copy link

@hfr hfr commented Mar 15, 2012

On Windows the function SshContext.popen pops up an empty command window. The reason is the strange behaviour of the Windows console. The documentation about it is sparse, so it might be difficult for some user to get rid of it. The solution is to start the console command as if it would be a GUI application and then to hide the main window.

This can be accomplished by passing a special startupinfo to subprocess.popen in case the platform is Windows.
The additional parameter startupinfo=None should not hurt on other platforms. I have tested it under Linux.

It would be nice if there lines could be added to ssh.py so that the use is easier for user running Windows.

rpyc/utils/ssh.py:

     import subprocess
     if subprocess.mswindows:
         SUI = subprocess.STARTUPINFO()
         SUI.dwFlags |= subprocess.STARTF_USESHOWWINDOW
         SUI.wShowWindow = subprocess.SW_HIDE
     else:
         SUI=None
     ...
     cwd = self.ssh_cwd, env = self.ssh_env, shell = False, startupinfo=SUI)
@tomerfiliba
Copy link
Collaborator

@tomerfiliba tomerfiliba commented Mar 15, 2012

please review the commit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants