Skip to content

Commit

Permalink
Add Warning output to error out in PS Core results.
Browse files Browse the repository at this point in the history
  • Loading branch information
bitbound committed Apr 16, 2021
1 parent 7c4f935 commit c00f171
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
7 changes: 3 additions & 4 deletions Agent/Services/PSCore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public ScriptResult WriteInput(string input)
using var ps = PowerShell.Create();
ps.AddScript("$args[0] | Out-String");
ps.AddArgument(results);
var hostOutput = (ps.Invoke()[0].BaseObject as string);
var hostOutput = (string)ps.Invoke()[0].BaseObject;

var verboseOut = _powershell.Streams.Verbose.ReadAll().Select(x => x.Message);
var debugOut = _powershell.Streams.Debug.ReadAll().Select(x => x.Message);
Expand All @@ -95,8 +95,7 @@ public ScriptResult WriteInput(string input)
var standardOut = hostOutput.Split(Environment.NewLine)
.Concat(infoOut)
.Concat(debugOut)
.Concat(verboseOut)
.Concat(warningOut);
.Concat(verboseOut);


return new ScriptResult()
Expand All @@ -106,7 +105,7 @@ public ScriptResult WriteInput(string input)
ScriptInput = input,
Shell = Shared.Enums.ScriptingShell.PSCore,
StandardOutput = standardOut.ToArray(),
ErrorOutput = errorOut.ToArray(),
ErrorOutput = errorOut.Concat(warningOut).ToArray(),
RunTime = sw.Elapsed,
HadErrors = _powershell.HadErrors
};
Expand Down
5 changes: 5 additions & 0 deletions Server/Server.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
</PropertyGroup>

<ItemGroup>
<Compile Remove="bin\**" />
<Content Remove="bin\**" />
<EmbeddedResource Remove="bin\**" />
<None Remove="bin\**" />
<TypeScriptCompile Remove="bin\**" />
<TypeScriptCompile Remove="node_modules\**" />
</ItemGroup>

Expand Down

0 comments on commit c00f171

Please sign in to comment.