diff --git a/powershell/resources/psruntime/BuildTime/PsHelpers.cs b/powershell/resources/psruntime/BuildTime/PsHelpers.cs index 9958d642638..4f9aed43c14 100644 --- a/powershell/resources/psruntime/BuildTime/PsHelpers.cs +++ b/powershell/resources/psruntime/BuildTime/PsHelpers.cs @@ -39,9 +39,10 @@ public static IEnumerable GetModuleCmdlets(params string[] modulePa public static IEnumerable GetScriptCmdlets(PSCmdlet cmdlet, string scriptFolder) { // https://stackoverflow.com/a/40969712/294804 + var wrappedFolder = scriptFolder.Contains("'") ? $@"""{scriptFolder}""" : $@"'{scriptFolder}'"; var getCmdletsCommand = $@" $currentFunctions = Get-ChildItem function: -Get-ChildItem -Path '{scriptFolder}' -Recurse -Include '*.ps1' -File | ForEach-Object {{ . $_.FullName }} +Get-ChildItem -Path {wrappedFolder} -Recurse -Include '*.ps1' -File | ForEach-Object {{ . $_.FullName }} Get-ChildItem function: | Where-Object {{ ($currentFunctions -notcontains $_) -and $_.CmdletBinding }} "; return cmdlet?.RunScript(getCmdletsCommand) ?? RunScript(getCmdletsCommand); diff --git a/powershell/resources/runtime/csharp/pipeline/PipelineMocking.cs b/powershell/resources/runtime/csharp/pipeline/PipelineMocking.cs index 33810ca9f7e..6082ba80ed8 100644 --- a/powershell/resources/runtime/csharp/pipeline/PipelineMocking.cs +++ b/powershell/resources/runtime/csharp/pipeline/PipelineMocking.cs @@ -259,4 +259,4 @@ public async Task SendAsync(HttpRequestMessage request, IEv } } } -} \ No newline at end of file +}