Fix "handle is invalid" error on AppVeyor

This commit is contained in:
George Fleming 2016-02-11 15:33:32 -08:00 committed by Andrew Schwartzmeyer
parent cc64b31741
commit 1ec5676f25
3 changed files with 18 additions and 2 deletions

View file

@ -16,6 +16,7 @@ namespace Microsoft.PowerShell.Linux.Host
public MyHost(Listener Listener)
{
this.Listener = Listener;
this.myHostUserInterface = new MyHostUserInterface(Listener.HasUI);
}
/// <summary>
@ -44,7 +45,7 @@ namespace Microsoft.PowerShell.Linux.Host
/// A reference to the implementation of the PSHostUserInterface
/// class for this application.
/// </summary>
private MyHostUserInterface myHostUserInterface = new MyHostUserInterface();
private MyHostUserInterface myHostUserInterface;
/// <summary>
/// A reference to the runspace used to start an interactive session.

View file

@ -187,8 +187,15 @@ OPTIONS
set { this.exitCode = value; }
}
/// <summary>
/// Gets or sets a value indicating whether UI should exit.
/// </summary>
public bool HasUI;
public Listener(string initialScript, bool loadProfiles)
{
HasUI = (initialScript == null) ? true : false;
// Create the host and runspace instances for this interpreter.
// Note that this application does not support console files so
// only the default snap-ins will be available.

View file

@ -17,10 +17,18 @@ namespace Microsoft.PowerShell.Linux.Host
/// </summary>
internal class MyHostUserInterface : PSHostUserInterface, IHostUISupportsMultipleChoiceSelection
{
/// <summary>
/// Public constructor
/// </summary>
public MyHostUserInterface(bool hasUI)
{
myRawUi = (hasUI) ? new MyRawUserInterface() : null;
}
/// <summary>
/// A reference to the PSRawUserInterface implementation.
/// </summary>
private MyRawUserInterface myRawUi = new MyRawUserInterface();
private MyRawUserInterface myRawUi;
/// <summary>
/// Gets an instance of the PSRawUserInterface class for this host