Skip to content

Commit

Permalink
Run SetInitialWorkingDirectoryAsync before LoadProfiles
Browse files Browse the repository at this point in the history
So that if a user runs `Set-Location` in their profile, it's not later
overridden.
  • Loading branch information
andyleejordan committed Oct 25, 2023
1 parent 993a54c commit 8612b46
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,13 @@ public async Task<bool> TryStartAsync(HostStartOptions startOptions, Cancellatio

_pipelineThread.Start();

if (startOptions.InitialWorkingDirectory is not null)
{
_logger.LogDebug($"Setting InitialWorkingDirectory to {startOptions.InitialWorkingDirectory}...");
await SetInitialWorkingDirectoryAsync(startOptions.InitialWorkingDirectory, cancellationToken).ConfigureAwait(false);
_logger.LogDebug("InitialWorkingDirectory set!");
}

if (startOptions.LoadProfiles)
{
_logger.LogDebug("Loading profiles...");
Expand All @@ -320,13 +327,6 @@ public async Task<bool> TryStartAsync(HostStartOptions startOptions, Cancellatio
_logger.LogDebug("Shell integration not enabled!");
}

if (startOptions.InitialWorkingDirectory is not null)
{
_logger.LogDebug($"Setting InitialWorkingDirectory to {startOptions.InitialWorkingDirectory}...");
await SetInitialWorkingDirectoryAsync(startOptions.InitialWorkingDirectory, cancellationToken).ConfigureAwait(false);
_logger.LogDebug("InitialWorkingDirectory set!");
}

await _started.Task.ConfigureAwait(false);
return true;
}
Expand Down

0 comments on commit 8612b46

Please sign in to comment.