Skip to content

Crash when prompt is undefined in the runspace #1699

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

Closed
dkattan opened this issue Feb 3, 2022 · 1 comment · Fixed by #1710
Closed

Crash when prompt is undefined in the runspace #1699

dkattan opened this issue Feb 3, 2022 · 1 comment · Fixed by #1710

Comments

@dkattan
Copy link
Contributor

dkattan commented Feb 3, 2022

When "prompt" isn't defined in the runspace the fallback to DefaultPrompt doesn't work because we aren't catching the CommandNotFoundException

var command = new PSCommand().AddCommand("prompt");
IReadOnlyList<string> results = InvokePSCommand<string>(command, PowerShellExecutionOptions.Default, cancellationToken);
string prompt = results.Count > 0 ? results[0] : DefaultPrompt;

@ghost ghost added the Needs: Triage Maintainer attention needed! label Feb 3, 2022
@JustinGrote JustinGrote added Area-Extension Terminal Issue-Bug A bug to squash. Preview Extension and removed Needs: Triage Maintainer attention needed! labels Feb 3, 2022
@JustinGrote
Copy link
Collaborator

Thanks! I don't want to know how you discovered this :P

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Feb 3, 2022
@JustinGrote JustinGrote removed the Needs: Maintainer Attention Maintainer attention needed! label Feb 3, 2022
@andyleejordan andyleejordan moved this to Todo in Sea Biscuit Feb 16, 2022
@andyleejordan andyleejordan changed the title An error occurred while running the REPL loop - System.Management.Automation.CommandNotFoundException: The term 'prompt' is not recognized as a name of a cmdlet, function, script file, or executable program. Crash when prompt is undefined in the runspace Feb 16, 2022
@andyleejordan andyleejordan moved this from Todo to In Progress in Sea Biscuit Feb 16, 2022
Repository owner moved this from In Progress to Done in Sea Biscuit Feb 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants