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

how to hide command prompt window pop up in client system when executing command or doing file operation using node-ssh #437

Open
gotcha1 opened this issue Aug 2, 2022 · 0 comments

Comments

@gotcha1
Copy link

gotcha1 commented Aug 2, 2022

In windows OS, if sshd.exe is running as a system service then it will suppress the GUI applications and runs them in hidden mode when triggered through ssh.
So, to avoid running GUI applications in hidden mode, I'm running sshd.exe process in windows (client system) as local user instead of system service. And GUI applications in client can be seen when invoked through node-ssh.

Now, when ever node-ssh' exec, put file, get file methods are used, a cmd window pop up appears on the client system.
Is there way to hide this window pop up other than using pty?

When execOptions: { pty: { width: 0, height: 0 } } is used, window pop is avoided but it lead to another problem. Using pty, stderr is always empty. The data is redirected to stdout . Also the output contains some extra characters as below:

{ code: null, signal: null, stdout: '\x1B[2J\x1B[m\x1B[H\x1B]0;Administrator: C:\\Windows\\system32\\conhost.exe\x07\x1B[?25hdesktop-85hs42d\\administrator', stderr: '' }

stderr is empty when exec command execution has error

{ code: null, signal: null, stdout: "\x1B[2J\x1B[m\x1B[H\x1B]0;Administrator: C:\\Windows\\system32\\conhost.exe\x07\x1B[?25h\x1B[38;5;9mwhoami. : The term 'whoami.' is not recognized as the name of a cmdlet, \x1B[m\x1B[38;5;9m\r\n" + 'function, script file, or operable program. Check the spelling of the name, or \r\n' + 'if a path was included, verify that the path is correct and try again.\r\n' + 'At line:1 char:1\r\n' + '+ whoami.\r\n' + '+ ~~~~~~~\r\n' + ' + CategoryInfo : ObjectNotFound: (whoami.:String) [], CommandNotF \r\n' + ' oundException\r\n' + ' + FullyQualifiedErrorId : CommandNotFoundException', stderr: '' }

@gotcha1 gotcha1 changed the title how to hide command prompt window when using ssh exec, put file and get file? how to hide command prompt window pop in client system when executing command or doing file operation using node-ssh Aug 2, 2022
@gotcha1 gotcha1 changed the title how to hide command prompt window pop in client system when executing command or doing file operation using node-ssh how to hide command prompt window pop up in client system when executing command or doing file operation using node-ssh Aug 2, 2022
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

No branches or pull requests

1 participant