steelbrain / steelbrain/node-ssh

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

Open
#437 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
1k
Forks
94
PR merge metrics
No merged PRs in 30d

Description

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: '' }

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the Windows behavior through node-ssh's exec, put, and get methods, comparing normal execution with execOptions using a zero-size pty. Done means the command window is hidden without relying on pty, while stderr remains separate and command output does not contain terminal escape sequences.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.