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

DebugConsole: make powershell work interactively like CMD #877

Closed
ahmelsayed opened this issue Nov 28, 2013 · 6 comments
Closed

DebugConsole: make powershell work interactively like CMD #877

ahmelsayed opened this issue Nov 28, 2013 · 6 comments
Assignees
Labels
Milestone

Comments

@ahmelsayed
Copy link
Member

Powershell doesn't seem to work with stdout and stdin redirection like cmd.exe. I am not sure what the issue is with powershell, but they might have more robust APIs to accomplish this. We need to investigate this with powershell team.
@Gissues:{"order":78.84615384615373,"status":"backlog"}

@ghost
Copy link

ghost commented Nov 28, 2013

I've played with this before and the best I've been able to do is call powershell -File -
Note the last "-" is important. you don't get a prompt but you get basic interactivity.

@davidebbo
Copy link
Member

Wow, I just tried that in the new interactive console and it actually works! Check out this session:

D:\home>powershell -File -
PS D:\home> get-process

Handles  NPM(K)    PM(K)      WS(K) VM(M)   CPU(s)     Id ProcessName          
-------  ------    -----      ----- -----   ------     -- -----------          
     45       7     2172       4180    29     0.05   2792 cmd                  
    227      20    39044      39004   184     0.63   3316 powershell           
   2125      70    51648      60352   327     2.86    576 w3wp                 


PS D:\home> exit

D:\home> 

@davidebbo
Copy link
Member

I tried prompting for input from PS and that blew up:

PS D:\home> $name = Read-Host 'What is your username?'
Read-Host : The Win32 internal error "The handle is invalid" 0x6 occurred 
PS D:\home> while getting the console mode. Contact Microsoft Customer Support Services.
At line:1 char:9
+ $name = Read-Host 'What is your username?'
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (:) [Read-Host], HostException
    + FullyQualifiedErrorId : GetConsoleMode,Microsoft.PowerShell.Commands.ReadHostCommand

@ghost ghost assigned ahmelsayed Dec 4, 2013
@ahmelsayed
Copy link
Member Author

interesting, that seems related to how Azure is handling the Console Win32 APIs because it's completely different from OnPrem. I will open a bug for Stephen.

on the other hand, it seems that powershell already has some form of web access http://technet.microsoft.com/en-us/library/hh831417.aspx

@ahmelsayed
Copy link
Member Author

@davidebbo since powershell works if you type "powershell -file -" instead of just "powershell" do you think it would be better if we just rewrite "powershell" to "powershell -file -" behind the scenes, display a sort of warning saying something like "type powershell -file - instead of powershell" or have a different link for powershell console all together?

@davidebbo
Copy link
Member

Yes, I suppose we could do that.

Maybe a better approach is to have buttons in the DebugConsole that lets the user select what shell they want. The thinking is that a powershell user should be able to directly be in powershell, as opposed to starting in cmd and having to type 'powershell' to get there.

Implementation wise, it could be a query string param that choose the mode, e.g. /commandstream?shell=PowerShell. Not familiar with the Console SignalR logic, so maybe there is more to it. :)

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

No branches or pull requests

2 participants