diff --git a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleControl.cs b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleControl.cs
index 0a7705332..e34d05988 100644
--- a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleControl.cs
+++ b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleControl.cs
@@ -1,4 +1,4 @@
-#if !PORTABLE
+#if !LINUX
/********************************************************************++
Copyright (c) Microsoft Corporation. All rights reserved.
--********************************************************************/
diff --git a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs
index 886b1539f..e8363a6c8 100644
--- a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs
+++ b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs
@@ -293,7 +293,7 @@ namespace Microsoft.PowerShell
///
///
///
-#if PORTABLE
+#if LINUX
private static void MyBreakHandler(object sender, ConsoleCancelEventArgs args)
{
// Set the Cancel property to true to prevent the process from terminating.
@@ -461,7 +461,7 @@ namespace Microsoft.PowerShell
// call the console APIs directly, instead of ui.rawui.FlushInputHandle, as ui may be finalized
// already if this thread is lagging behind the main thread.
-#if !PORTABLE
+#if !LINUX
ConsoleHandle handle = ConsoleControl.GetConioDeviceHandle();
ConsoleControl.FlushConsoleInputBuffer(handle);
#endif
@@ -1059,7 +1059,7 @@ namespace Microsoft.PowerShell
private void BindBreakHandler()
{
-#if PORTABLE
+#if LINUX
Console.CancelKeyPress += new ConsoleCancelEventHandler(MyBreakHandler);
#else
breakHandlerGcHandle = GCHandle.Alloc(new ConsoleControl.BreakHandler(MyBreakHandler));
@@ -1118,7 +1118,7 @@ namespace Microsoft.PowerShell
{
if (!isDisposed)
{
-#if !PORTABLE
+#if !LINUX
Dbg.Assert(breakHandlerGcHandle != null, "break handler should be set");
ConsoleControl.RemoveBreakHandler();
breakHandlerGcHandle.Free();
@@ -2867,7 +2867,7 @@ namespace Microsoft.PowerShell
///
private RunspaceRef runspaceRef;
-#if !PORTABLE
+#if !LINUX
private GCHandle breakHandlerGcHandle;
#endif
private System.Threading.Thread breakHandlerThread;
diff --git a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostRawUserInterface.cs b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostRawUserInterface.cs
index 77986f8d8..2c260fb47 100644
--- a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostRawUserInterface.cs
+++ b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostRawUserInterface.cs
@@ -1,4 +1,4 @@
-#if !PORTABLE
+#if !LINUX
/********************************************************************++
Copyright (c) Microsoft Corporation. All rights reserved.
--********************************************************************/
diff --git a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostUserInterface.cs b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostUserInterface.cs
index a7db0f5bf..8dbf99f24 100644
--- a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostUserInterface.cs
+++ b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostUserInterface.cs
@@ -14,7 +14,7 @@ using System.Management.Automation.Internal;
using System.Management.Automation.Host;
using System.Security;
using Dbg = System.Management.Automation.Diagnostics;
-#if !PORTABLE
+#if !LINUX
using ConsoleHandle = Microsoft.Win32.SafeHandles.SafeFileHandle;
#endif
@@ -61,7 +61,7 @@ namespace Microsoft.PowerShell
this.parent = parent;
this.rawui = new ConsoleHostRawUserInterface(this);
-#if PORTABLE
+#if LINUX
this._supportsVirtualTerminal = true;
#else
try
@@ -285,7 +285,7 @@ namespace Microsoft.PowerShell
private object ReadLineSafe(bool isSecureString, char? printToken)
{
-#if PORTABLE
+#if LINUX
throw new PlatformNotSupportedException("Cannot read secure strings!");
#else
// Don't lock (instanceLock) in here -- the caller needs to do that...
@@ -411,7 +411,7 @@ namespace Microsoft.PowerShell
#endif
}
-#if !PORTABLE
+#if !LINUX
///
///
@@ -560,7 +560,7 @@ namespace Microsoft.PowerShell
internal void WriteToConsole(string value, bool transcribeResult)
{
-#if !PORTABLE
+#if !LINUX
ConsoleHandle handle = ConsoleControl.GetActiveScreenBufferHandle();
// Ensure that we're in the proper line-output mode. We don't lock here as it does not matter if we
@@ -583,7 +583,7 @@ namespace Microsoft.PowerShell
// This is atomic, so we don't lock here...
-#if !PORTABLE
+#if !LINUX
ConsoleControl.WriteConsole(handle, value);
#else
Console.Out.Write(value);
@@ -1637,7 +1637,7 @@ namespace Microsoft.PowerShell
private string ReadLineFromConsole(bool endOnTab, string initialContent, bool calledFromPipeline, ref string restOfLine, ref ReadLineResult result)
{
-#if PORTABLE
+#if LINUX
return ReadLineFromFile(initialContent);
#else
ConsoleHandle handle = ConsoleControl.GetConioDeviceHandle();
@@ -1771,7 +1771,7 @@ namespace Microsoft.PowerShell
///
/// the cursor position where 'tab' is hit
///
-#if !PORTABLE
+#if !LINUX
private char GetCharacterUnderCursor(Coordinates cursorPosition)
{
Rectangle region = new Rectangle(0, cursorPosition.Y, RawUI.BufferSize.Width - 1, cursorPosition.Y);
@@ -1840,7 +1840,7 @@ namespace Microsoft.PowerShell
ReadLineResult rlResult = ReadLineResult.endedOnEnter;
-#if !PORTABLE
+#if !LINUX
ConsoleHandle handle = ConsoleControl.GetActiveScreenBufferHandle();
string lastCompletion = "";
@@ -1874,7 +1874,7 @@ namespace Microsoft.PowerShell
break;
}
-#if PORTABLE // Portable code only ends on enter (or no input), so tab is not processed
+#if LINUX // Portable code only ends on enter (or no input), so tab is not processed
throw new PlatformNotSupportedException("This readline state is unsupported in portable code!");
#else
@@ -2000,7 +2000,7 @@ namespace Microsoft.PowerShell
return input;
}
-#if !PORTABLE
+#if !LINUX
private void SendLeftArrows(int length)
{
var inputs = new ConsoleControl.INPUT[length * 2];
diff --git a/src/Microsoft.PowerShell.ConsoleHost/project.json b/src/Microsoft.PowerShell.ConsoleHost/project.json
index f79fb421f..d46da8d86 100644
--- a/src/Microsoft.PowerShell.ConsoleHost/project.json
+++ b/src/Microsoft.PowerShell.ConsoleHost/project.json
@@ -31,6 +31,15 @@
]
},
+ "configurations": {
+ "Linux": {
+ "buildOptions": {
+ "define": [ "LINUX" ]
+ }
+ }
+ },
+
+
"dependencies": {
"Microsoft.PowerShell.PSReadLine": "1.0.0-*",
"Microsoft.PowerShell.Commands.Diagnostics": "1.0.0-*",