![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | Exit error in Pipeline Seems if you have "exit" in script and run it in NestedPipeline, you get an error you can't catch and it bogs the shell. Example: string runScript = "echo hello;exit"; Pipeline p = Runspace.DefaultRunspace.CreateNestedPipeline(runScript, false); using(p) { // Exception: Cannot exit nested prompt because no nested prompts exist. Collection<PSObject> results = p.Invoke(inputArray); // <= Error } What gives? -- William Stacey [C# MVP] |
| | #2 (permalink) | ||||||||||||
| Guest | Re: Exit error in Pipeline On Sep 7, 7:17 pm, "William Stacey [C# MVP]" <william.sta...@xxxxxx> wrote:
- Oisin | ||||||||||||
| | #3 (permalink) |
| Guest | Re: Exit error in Pipeline ? I was not talking about a nested prompt. The code shows nested pipeline. The question is if you have "exit" in the script, it will throw an error you can not catch and also screws the runspace to boot. -- William Stacey [C# MVP] "Oisin Grehan" <oising@xxxxxx> wrote in message news:1189288496.214391.75060@xxxxxx | On Sep 7, 7:17 pm, "William Stacey [C# MVP]" | <william.sta...@xxxxxx> wrote: | > Seems if you have "exit" in script and run it in NestedPipeline, you get an | > error you can't catch and it bogs the shell. Example: | > | > string runScript = "echo hello;exit"; | > Pipeline p = Runspace.DefaultRunspace.CreateNestedPipeline(runScript, | > false); | > using(p) | > { | > // Exception: Cannot exit nested prompt because no nested prompts exist. | > Collection<PSObject> results = p.Invoke(inputArray); // <= Error | > | > } | > | > What gives? | > -- | > William Stacey [C# MVP] | | A nested prompt is a nested RUNSPACE, not a nested pipeline. | | - Oisin | |
| | #4 (permalink) | ||||||||||||
| Guest | Re: Exit error in Pipeline On Sep 8, 7:18 pm, "William Stacey [C# MVP]" <william.sta...@xxxxxx> wrote:
expecting it to exit the nested pipeline (thus implying to me that you were thinking runspaces). Anyway, that's weird. Out of interest, is it _really_ a nested pipeline for the current runspace? (meaning there is a parent pipeline in process) - Oisin | ||||||||||||
| | #5 (permalink) |
| Guest | Re: Exit error in Pipeline right. The current pipeline is the currently executing pipeline (in this case current pipeline of the psh runspace that started this cmdlet). So this cmdlet starts a nestedpipeline (as we can't start a new pipeline because one is already running) to run the script. I think they could probably special case "exit" in this case and just do a "return" to avoid the error. -- William Stacey [C# MVP] "Oisin Grehan" <oising@xxxxxx> wrote in message news:1189302642.558959.176070@xxxxxx | On Sep 8, 7:18 pm, "William Stacey [C# MVP]" | <william.sta...@xxxxxx> wrote: | > ? I was not talking about a nested prompt. The code shows nested pipeline. | > The question is if you have "exit" in the script, it will throw an error you | > can not catch and also screws the runspace to boot. | > | > -- | > William Stacey [C# MVP] | > | > "Oisin Grehan" <ois...@xxxxxx> wrote in message | > | > news:1189288496.214391.75060@xxxxxx | > | On Sep 7, 7:17 pm, "William Stacey [C# MVP]"| <william.sta...@xxxxxx> wrote: | > | > | > Seems if you have "exit" in script and run it in NestedPipeline, you get | > an | > | > error you can't catch and it bogs the shell. Example: | > | > | > | > string runScript = "echo hello;exit"; | > | > Pipeline p = Runspace.DefaultRunspace.CreateNestedPipeline(runScript, | > | > false); | > | > using(p) | > | > { | > | > // Exception: Cannot exit nested prompt because no nested prompts | > exist. | > | > Collection<PSObject> results = p.Invoke(inputArray); // <= Error | > | > | > | > } | > | > | > | > What gives? | > | > -- | > | > William Stacey [C# MVP] | > | | > | A nested prompt is a nested RUNSPACE, not a nested pipeline. | > | | > | - Oisin | > | | | Ah I see what you mean. I thought you deliberately put the exit there, | expecting it to exit the nested pipeline (thus implying to me that you | were thinking runspaces). Anyway, that's weird. Out of interest, is it | _really_ a nested pipeline for the current runspace? (meaning there is | a parent pipeline in process) | | - Oisin | |
| |
| |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| exit | Justin Rich | PowerShell | 0 | 07-29-2008 08:41 AM |
| .NET error on boot up, failure to exit windows | Stukie | Vista networking & sharing | 0 | 05-06-2008 06:34 PM |
| Using the $_ pipeline with WMI | Larry R | PowerShell | 2 | 04-27-2007 09:27 AM |
| delete on exit | emfd6100 | Vista mail | 1 | 02-23-2007 02:49 AM |
| .NET 1.1 exe remains in-use after exit | SYNC/Anang | Vista networking & sharing | 4 | 05-30-2006 01:49 AM |