diff --git a/extensions/WSLExtension/Constants.cs b/extensions/WSLExtension/Constants.cs
index cd07902e9b..0070766175 100644
--- a/extensions/WSLExtension/Constants.cs
+++ b/extensions/WSLExtension/Constants.cs
@@ -39,17 +39,8 @@ public static class Constants
public const int WslVersion2 = 2;
public const int WslExeExitSuccess = 0;
- // Launch terminal with specific profile and log the user into their home directory in the login shell
- // Note: this opens a new terminal window in the UI
- public static string LaunchDistributionInTerminalWithProfile { get; } = "--profile {0} -- wsl --shell-type login --cd ~ --distribution {1}";
-
- // Launch without using a Terminal profile and log the user into their home directory using the login shell
- // Note: this opens a new terminal window in the UI
- public static string LaunchDistributionInTerminalWithNoProfile { get; } = "wsl --shell-type login --cd ~ --distribution {0}";
-
// Launch into the wsl process without terminal and log the user into their home directory using the login shell
- // Note: this opens a new terminal window in the UI
- public static string LaunchDistributionWithoutTerminal { get; } = "--shell-type login --cd ~ --distribution {0}";
+ public static string LaunchDistributionArgs { get; } = "--shell-type login --cd ~ --distribution {0}";
// Arguments to unregister a wsl distribution from a machine using wsl.exe
public const string UnregisterDistributionArgs = "--unregister {0}";
@@ -57,13 +48,8 @@ public static class Constants
// Arguments to terminate all wsl sessions for a specific distribution using wsl.exe
public const string TerminateDistributionArgs = "--terminate {0}";
- // Arguments to download, install and register a wsl distribution using Terminal
- // Note: this opens a new terminal window in the UI
- public const string InstallDistributionWithTerminal = "wsl --install --distribution {0}";
-
- // Arguments to download, install and register a wsl distribution without using terminal
- // Note: this opens a cmd window in the UI
- public const string InstallDistributionWithoutTerminal = "--install --distribution {0}";
+ // Arguments to download, install and register a wsl distribution.
+ public const string InstallDistributionArgs = "--install --distribution {0}";
// Arguments to list of all running distributions on a machine using wsl.exe
public const string ListAllRunningDistributions = "--list --running";
diff --git a/extensions/WSLExtension/Contracts/IWslManager.cs b/extensions/WSLExtension/Contracts/IWslManager.cs
index eadaf4b014..76e16887ba 100644
--- a/extensions/WSLExtension/Contracts/IWslManager.cs
+++ b/extensions/WSLExtension/Contracts/IWslManager.cs
@@ -36,7 +36,7 @@ public interface IWslManager
/// Launches a new WSL distribution.
/// This is a wrapper for
///
- void LaunchDistribution(string distributionName, string? windowsTerminalProfile);
+ void LaunchDistribution(string distributionName);
/// Installs a new WSL distribution.
/// This is a wrapper for
diff --git a/extensions/WSLExtension/Contracts/IWslServicesMediator.cs b/extensions/WSLExtension/Contracts/IWslServicesMediator.cs
index 2915dea08f..fec0143246 100644
--- a/extensions/WSLExtension/Contracts/IWslServicesMediator.cs
+++ b/extensions/WSLExtension/Contracts/IWslServicesMediator.cs
@@ -29,7 +29,7 @@ public interface IWslServicesMediator
void UnregisterDistribution(string distributionName);
/// Launches a new WSL process with the provided distribution.
- void LaunchDistribution(string distributionName, string? windowsTerminalProfile);
+ void LaunchDistribution(string distributionName);
/// Installs and registers a new distribution on the machine.
void InstallDistribution(string distributionName);
diff --git a/extensions/WSLExtension/Models/WslComputeSystem.cs b/extensions/WSLExtension/Models/WslComputeSystem.cs
index 2d55e2344f..23dd95248f 100644
--- a/extensions/WSLExtension/Models/WslComputeSystem.cs
+++ b/extensions/WSLExtension/Models/WslComputeSystem.cs
@@ -286,7 +286,7 @@ public IAsyncOperation ConnectAsync(string options
try
{
UpdateState(ComputeSystemState.Starting);
- _wslManager.LaunchDistribution(Id, _distribution.AssociatedTerminalProfileGuid);
+ _wslManager.LaunchDistribution(Id);
UpdateState(ComputeSystemState.Running);
return new ComputeSystemOperationResult();
}
diff --git a/extensions/WSLExtension/Models/WslInstallDistributionOperation.cs b/extensions/WSLExtension/Models/WslInstallDistributionOperation.cs
index 0e5b3220d1..3fb15d1036 100644
--- a/extensions/WSLExtension/Models/WslInstallDistributionOperation.cs
+++ b/extensions/WSLExtension/Models/WslInstallDistributionOperation.cs
@@ -59,13 +59,13 @@ public IAsyncOperation StartAsync()
var startTime = DateTime.UtcNow;
_log.Information($"Starting installation for {_definition.Name}");
Progress?.Invoke(this, new CreateComputeSystemProgressEventArgs(_preparingToInstall, 0));
- _wslManager.InstallDistribution(_definition.Name);
// Cancel waiting for install if the distribution hasn't been installed after 10 minutes.
CancellationTokenSource cancellationTokenSource = new CancellationTokenSource();
cancellationTokenSource.CancelAfter(TimeSpan.FromMinutes(10));
WslRegisteredDistribution? registeredDistribution = null;
var distributionInstalledSuccessfully = false;
+ _wslManager.InstallDistribution(_definition.Name);
Progress?.Invoke(this, new CreateComputeSystemProgressEventArgs(_waitingToComplete, 0));
while (!cancellationTokenSource.IsCancellationRequested)
diff --git a/extensions/WSLExtension/Services/WslManager.cs b/extensions/WSLExtension/Services/WslManager.cs
index 257bd97780..76c816d5aa 100644
--- a/extensions/WSLExtension/Services/WslManager.cs
+++ b/extensions/WSLExtension/Services/WslManager.cs
@@ -117,9 +117,9 @@ public void UnregisterDistribution(string distributionName)
}
///
- public void LaunchDistribution(string distributionName, string? windowsTerminalProfile = null)
+ public void LaunchDistribution(string distributionName)
{
- _wslServicesMediator.LaunchDistribution(distributionName, windowsTerminalProfile);
+ _wslServicesMediator.LaunchDistribution(distributionName);
}
///
diff --git a/extensions/WSLExtension/Services/WslServicesMediator.cs b/extensions/WSLExtension/Services/WslServicesMediator.cs
index 3d83056b23..7d3e7d5ed9 100644
--- a/extensions/WSLExtension/Services/WslServicesMediator.cs
+++ b/extensions/WSLExtension/Services/WslServicesMediator.cs
@@ -1,7 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
-using System.Diagnostics;
using Microsoft.Win32;
using WSLExtension.ClassExtensions;
using WSLExtension.Contracts;
@@ -148,36 +147,12 @@ public void UnregisterDistribution(string distributionName)
}
///
- public void LaunchDistribution(string distributionName, string? windowsTerminalProfile)
+ public void LaunchDistribution(string distributionName)
{
- var executable = GetFileNameForProcessLaunch();
-
- // Only launch with terminal if its installed
- if (executable.Equals(WindowsTerminalShimExe, StringComparison.OrdinalIgnoreCase))
- {
- LaunchDistributionUsingTerminal(distributionName, windowsTerminalProfile);
- return;
- }
-
- // Default to starting the wsl process directly and passing in its command line args
- _processCreator.CreateProcessWithWindow(executable, LaunchDistributionWithoutTerminal.FormatArgs(distributionName));
- }
-
- private void LaunchDistributionUsingTerminal(string distributionName, string? windowsTerminalProfile)
- {
- var terminalArgs = LaunchDistributionInTerminalWithNoProfile.FormatArgs(distributionName);
-
- if (!string.IsNullOrEmpty(windowsTerminalProfile))
- {
- // Launch into terminal with the specified profile and run wsl.exe in the console window
- terminalArgs = LaunchDistributionInTerminalWithProfile.FormatArgs(windowsTerminalProfile, distributionName);
- _processCreator.CreateProcessWithWindow(WindowsTerminalShimExe, terminalArgs);
- }
- else
- {
- // Launch into terminal and run wsl.exe in the console window without a profile
- _processCreator.CreateProcessWithWindow(WindowsTerminalShimExe, terminalArgs);
- }
+ // Start the wsl process directly and passing in its command line args
+ _processCreator.CreateProcessWithWindow(
+ WslExe,
+ LaunchDistributionArgs.FormatArgs(distributionName));
}
///
@@ -194,21 +169,8 @@ public void TerminateDistribution(string distributionName)
///
public void InstallDistribution(string distributionName)
{
- var executable = GetFileNameForProcessLaunch();
-
- // Launch into terminal if its installed and run wsl.exe in the console window
- if (executable.Equals(WindowsTerminalShimExe, StringComparison.OrdinalIgnoreCase))
- {
- _processCreator.CreateProcessWithWindow(executable, InstallDistributionWithTerminal.FormatArgs(distributionName));
- return;
- }
-
- // Default to starting the wsl process directly and passing in its command line args
- _processCreator.CreateProcessWithWindow(executable, InstallDistributionWithoutTerminal.FormatArgs(distributionName));
- }
-
- private string GetFileNameForProcessLaunch()
- {
- return _packageHelper.IsPackageInstalled(WindowsTerminalPackageFamilyName) ? WindowsTerminalShimExe : WslExe;
+ _processCreator.CreateProcessWithWindow(
+ WslExe,
+ InstallDistributionArgs.FormatArgs(distributionName));
}
}