File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed
test/PowerShellEditorServices.Test.E2E Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change 1- // Copyright (c) Microsoft Corporation.
1+ // Copyright (c) Microsoft Corporation.
22// Licensed under the MIT License.
33
44using System ;
@@ -136,11 +136,23 @@ private string GenerateScriptFromLoggingStatements(params string[] logStatements
136136 }
137137
138138 // Have script create file first with `>` (but don't rely on overwriting).
139- StringBuilder builder = new StringBuilder ( ) . Append ( '\' ' ) . Append ( logStatements [ 0 ] ) . Append ( "' > '" ) . Append ( s_testOutputPath ) . AppendLine ( "'" ) ;
139+ // NOTE: We uses double quotes so that we can use PowerShell variables.
140+ StringBuilder builder = new StringBuilder ( )
141+ . Append ( "Write-Output \" " )
142+ . Append ( logStatements [ 0 ] )
143+ . Append ( "\" > '" )
144+ . Append ( s_testOutputPath )
145+ . AppendLine ( "'" ) ;
146+
140147 for ( int i = 1 ; i < logStatements . Length ; i ++ )
141148 {
142149 // Then append to that script with `>>`.
143- builder . Append ( '\' ' ) . Append ( logStatements [ i ] ) . Append ( "' >> '" ) . Append ( s_testOutputPath ) . AppendLine ( "'" ) ;
150+ builder
151+ . Append ( "Write-Output \" " )
152+ . Append ( logStatements [ i ] )
153+ . Append ( "\" >> '" )
154+ . Append ( s_testOutputPath )
155+ . AppendLine ( "'" ) ;
144156 }
145157
146158 _output . WriteLine ( "Script is:" ) ;
You can’t perform that action at this time.
0 commit comments