My question - using powershell with a "dumb" *nix terminal emulator - has been asked several times on this forum, but I came across a workaround for a similar problem on Windows fora, so am asking the question again.
Here are two relevant WinSSHD forum exchanges (same problem I'm having)...
powershell malfunctions if stdin is redirected.
In this exchange it's said that "Powershell simply doesn't work well with redirected I/O. I can't see any reasons why it couldn't work this way..."
I poked around a bit and found this post at stackoverflow:
and this post at Microsoft connect:
(I can't tell from the July 2010 workaround at the MS site whether or not "-noninteractive" behaves the same as the undocumented "-inputformat none")
In addition, there's a Feb 2012 Microsoft response that updates a 2007 request for additional functionality in powershell. It may not be relevant:
---> Back to the question: powershell and "dumb" terminals:
Are any of posts (c) through (e) relevant?
Posts (c) and (d) look very much like the "dumb terminal" hang encountered when the Windows login shell is powershell.
I altered my login shell entry on the Windows box to be:
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -inputformat none
but when I connected, powershell once again hung.
Powershell seems to run fine locally with both -inputformat none and -noninteractive.
If posts (c) thru (e) are relevant, do they suggest a work-around?
Much obliged for any suggestions...
I am connecting with
OpenSSH_5.5p1, OpenSSL 1.0.0e-fips 6 Sep 2011
from a Fedora 14 linux system.
Console output in the linux window (a gnome-term) is:
$ TERM="" ssh <Windows machine>
Enter passphrase for key '/home/jhs/.ssh/id_rsa':
Copyright (C) 2009 Microsoft Corporation. All rights reserved.
The Windows OS is Windows Home Premium, SP1, with all updates installed.
Powershell is v2.
The WinSSHD version is 5.26
two more possibly relevant posts:
OK, solved for me per this link:
(about mid-way down the page, see the note under the heading "Invoke a powerShell Command ...)
When PowerShell detects that its input or output streams have been redirected, it suppresses any prompts that it might normally display. If you are want to host an interactive PowerShell prompt inside another application (such as Emacs), use "-" as the argument for the -File parameter. In many shells, this implies "taken from standard input."
powershell -File -
When I set the WinSSHD login shell command line to use this hack, I can log in from my dumb terminal window, and everything works.
The one fly in the ointment is that the terminal window acts half-duplex: I don't get to see the line I'm typing - not while I'm typing, not after I type the newline ... I get the output of the command, so powershell is getting the command and executing it and sending back the results, but it is not echo'ing the characters I typed in the terminal window.
This works for me because my "dumb" terminal (9term) has a menu option that toggles between "cooked" and "uncooked" modes (as in stty cooked).
The 9term man page here:
discusses what's going on; see the para that starts "9term changes behavior according to the terminal settings..."
There seem to be many parameters one can play with, scattered across a wide range of applications.
This hack accomplishes what I wanted to accomplish.
This topic is archived. No further replies will be accepted.Other recent topics