Skip to content

Commit

Permalink
linter fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mateusz.wojtania committed Jan 8, 2025
1 parent d1f2676 commit e8578d9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public void TestTheWholeThing()
Assert.AreEqual("", taskUserInterface.ReadLine());
Assert.AreEqual(1, taskUserInterface.PromptForChoice("Caption", "Message", new Collection<ChoiceDescription>(), 1));

var answer = taskUserInterface.Prompt("Caption", "Message", new Collection<FieldDescription> { new ("Name") });
var answer = taskUserInterface.Prompt("Caption", "Message", new Collection<FieldDescription> { new("Name") });
Assert.AreEqual(1, answer.Count);

Assert.Throws<NotImplementedException>(() => taskUserInterface.PromptForCredential("Caption", "Message", "UserName", "TargetName"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ public static PowerShellResult RunCommand(RunCommandInput input, [Browsable(fals
{
return DoAndHandleSession(options?.Session, (session) =>
{
if (input.ExecuteNativeShell){
if (input.ExecuteNativeShell)
{
var tempScript = Path.Combine(Path.GetTempPath(), $"{Path.GetRandomFileName()}.ps1");
try
{
Expand All @@ -55,22 +56,25 @@ public static PowerShellResult RunCommand(RunCommandInput input, [Browsable(fals
{
File.Delete(tempScript);
}
} else
return ExecuteCommand(input.Command, input.Parameters, input.LogInformationStream, session.PowerShell);
}
else
return ExecuteCommand(input.Command, input.Parameters, input.LogInformationStream, session.PowerShell);
});
}
private static PowerShellResult ExecuteProcess(string scriptPath, PowerShellParameter[] parameters){
private static PowerShellResult ExecuteProcess(string scriptPath, PowerShellParameter[] parameters)
{
List<dynamic> results = new();
List<string> errors = new();



using Process process = new();
process.StartInfo = new()
{
FileName = "powershell.exe",
Arguments = $"-NoProfile -ExecutionPolicy Bypass -File \"{scriptPath}\" ",
UseShellExecute = false,CreateNoWindow = true,
UseShellExecute = false,
CreateNoWindow = true,
RedirectStandardError = true,
RedirectStandardOutput = true,
};
Expand Down Expand Up @@ -133,7 +137,7 @@ private static PowerShellResult ExecutePowershell(System.Management.Automation.P
try
{
var execution = powershell.Invoke();
var result = new PowerShellResult (
var result = new PowerShellResult(
// Powershell return values are usually wrapped inside of a powershell object, unwrap it or if it does not have a baseObject, return the actual object
execution?.Select(GetResultObject).ToList(),
GetErrorMessages(powershell.Streams.Error),
Expand Down

0 comments on commit e8578d9

Please sign in to comment.