Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable executing from native PS #28

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open

enable executing from native PS #28

wants to merge 9 commits into from

Conversation

MatteoDelOmbra
Copy link

@MatteoDelOmbra MatteoDelOmbra commented Jan 8, 2025

Summary by CodeRabbit

  • New Features

    • Added option to run PowerShell commands and scripts using native shell execution.
    • Introduced ExecuteNativeShell parameter for more flexible PowerShell interactions.
  • Version Updates

    • Updated Frends.PowerShell.RunCommand to version 1.3.0.
    • Updated Frends.PowerShell.RunScript to version 1.3.0.
  • Improvements

    • Enhanced script and command execution capabilities.
    • Expanded support for complex PowerShell script scenarios.

Copy link

coderabbitai bot commented Jan 8, 2025

Walkthrough

The pull request introduces a new feature across two PowerShell-related modules: Frends.PowerShell.RunCommand and Frends.PowerShell.RunScript. The primary enhancement is the addition of an ExecuteNativeShell option, which allows users to run PowerShell commands and scripts using the native shell instead of the PowerShell runtime. This feature provides more flexibility in script and command execution, with version numbers updated to 1.3.0 for both modules.

Changes

File Change Summary
Frends.PowerShell.RunCommand/CHANGELOG.md and Frends.PowerShell.RunScript/CHANGELOG.md Added version 1.3.0 entry with native PowerShell shell execution feature
Frends.PowerShell.RunCommand/Frends.PowerShell.RunCommand.csproj and Frends.PowerShell.RunScript/Frends.PowerShell.RunScript.csproj Updated version from 1.2.0 to 1.3.0
Frends.PowerShell.RunCommand/Definitions/RunCommandInput.cs and Frends.PowerShell.RunScript/Definitions/RunScriptInput.cs Added ExecuteNativeShell boolean property with documentation
Frends.PowerShell.RunCommand/PowerShell.cs and Frends.PowerShell.RunScript/PowerShell.cs Added ExecuteProcess method for native shell script/command execution
Frends.PowerShell.RunCommand/Frends.PowerShell.RunCommand.Tests/UnitTests.cs and Frends.PowerShell.RunScript/Frends.PowerShell.RunScript.Tests/UnitTests.cs Added RunScript_ShouldRunFromNativeShell test method
Frends.PowerShell.RunCommand/Frends.PowerShell.RunCommand.Tests/TaskUserInterfaceTests.cs and Frends.PowerShell.RunScript/Frends.PowerShell.RunScript.Tests/TaskUserInterfaceTests.cs Minor formatting change in TaskUserInterfaceTests class
.github/workflows/RunCommand_build_and_test_on_push.yml and .github/workflows/RunScript_build_and_test_on_push.yml Updated event triggers from single to double quotes for paths

Sequence Diagram

sequenceDiagram
    participant User
    participant PowerShellMethod
    participant NativeShell
    participant ScriptFile
    participant OutputCapture

    User->>PowerShellMethod: Invoke with ExecuteNativeShell=true
    PowerShellMethod->>ScriptFile: Create temporary script
    PowerShellMethod->>NativeShell: Execute script via powershell.exe
    NativeShell-->>OutputCapture: Capture stdout/stderr
    NativeShell->>ScriptFile: Delete temporary script
    OutputCapture-->>User: Return execution results
Loading

Poem

🐰 A Rabbit's Ode to PowerShell Delight 🐰
With native shell now in our sight,
Scripts dance and commands take flight!
Flexibility leaps with joyous bound,
New pathways of execution found.
Code hops freely, no runtime constraint! 🚀

Finishing Touches

  • 📝 Generate Docstrings

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

🧹 Nitpick comments (7)
Frends.PowerShell.RunScript/CHANGELOG.md (1)

4-5: Enhance changelog clarity and fix word repetition.

The changelog entry could be more descriptive and has unnecessary word repetition.

 ### Added
-Added option to run script using native PowerShell
+Option to execute scripts using native PowerShell shell, providing better compatibility and performance when running on PowerShell-enabled systems
🧰 Tools
🪛 LanguageTool

[duplication] ~4-~4: Possible typo: you repeated a word
Context: ... Changelog ## [1.3.0] - 2025-01-08 ### Added - Added option to run script using native Power...

(ENGLISH_WORD_REPEAT_RULE)

Frends.PowerShell.RunScript/Frends.PowerShell.RunScript/Definitions/RunScriptInput.cs (1)

46-52: Enhance documentation for ExecuteNativeShell property

The documentation should clarify:

  • What "basic usage" means in this context
  • The implications of using native shell (e.g., performance, security considerations)
  • Any prerequisites or requirements for native shell execution

Consider expanding the documentation:

     /// <summary>
     /// Define which version of PowerShell to use.
-    /// Useful in more complex scripts, as default version supports only basic usage
+    /// When set to true, executes the script using native PowerShell process instead of the PowerShell runtime.
+    /// Useful for complex scripts that require full PowerShell capabilities or specific PowerShell versions.
+    /// Note: Requires PowerShell to be installed on the system.
     /// </summary>
Frends.PowerShell.RunScript/Frends.PowerShell.RunScript.Tests/UnitTests.cs (1)

32-53: Enhance test coverage for native shell execution

While the basic functionality is tested, consider adding test cases for:

  • Error handling in native shell
  • Complex scripts that specifically require native shell
  • Working directory specification
  • PowerShell version selection (if applicable)

Would you like me to help generate additional test cases to improve coverage?

Frends.PowerShell.RunCommand/CHANGELOG.md (1)

3-5: Enhance changelog entry with more details

The changelog entry could be more descriptive about the feature and its implications.

Consider expanding the entry:

 ## [1.3.0] - 2025-01-08
 ### Added
-Added option to run command using native PowerShell
+- Added `ExecuteNativeShell` option to enable native PowerShell execution
+- Supports complex scripts requiring full PowerShell capabilities
+- Requires PowerShell to be installed on the target system
🧰 Tools
🪛 LanguageTool

[duplication] ~4-~4: Possible typo: you repeated a word
Context: ... Changelog ## [1.3.0] - 2025-01-08 ### Added - Added option to run command using native Powe...

(ENGLISH_WORD_REPEAT_RULE)

Frends.PowerShell.RunCommand/Frends.PowerShell.RunCommand/Frends.PowerShell.RunCommand.csproj (1)

10-10: Update package description to reflect native shell support

The description should mention the new native shell execution capability.

Consider updating the description:

-	<Description>Task for running commands on PowerShell. Requires PowerShell 7.0 to work.</Description>
+	<Description>Task for running commands on PowerShell with support for both runtime and native shell execution. Requires PowerShell 7.0 or later to work.</Description>

Also applies to: 19-19

Frends.PowerShell.RunCommand/Frends.PowerShell.RunCommand.Tests/UnitTests.cs (1)

67-67: Rename test method to match the functionality being tested

The test method name RunScript_ShouldRunFromNativeShell suggests it's testing script execution, but it's actually testing command execution using RunCommand. Consider renaming to RunCommand_ShouldRunFromNativeShell for clarity.

-    public void RunScript_ShouldRunFromNativeShell()
+    public void RunCommand_ShouldRunFromNativeShell()
Frends.PowerShell.RunCommand/Frends.PowerShell.RunCommand/Definitions/RunCommandInput.cs (1)

30-36: Clarify Documentation for ExecuteNativeShell Property

The XML documentation for ExecuteNativeShell could be improved to clearly explain its purpose and usage.

Consider updating the summary to provide more detailed information:

 /// <summary>
-/// Define which version of PowerShell to use.
-/// Useful in more complex scripts, as default version supports only basic usage
+/// If true, executes the command using the native PowerShell shell (`powershell.exe`).
+/// This allows for executing scripts that require features not supported by the default runtime.
 /// </summary>
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 713abde and d1f2676.

📒 Files selected for processing (10)
  • Frends.PowerShell.RunCommand/CHANGELOG.md (1 hunks)
  • Frends.PowerShell.RunCommand/Frends.PowerShell.RunCommand.Tests/UnitTests.cs (1 hunks)
  • Frends.PowerShell.RunCommand/Frends.PowerShell.RunCommand/Definitions/RunCommandInput.cs (1 hunks)
  • Frends.PowerShell.RunCommand/Frends.PowerShell.RunCommand/Frends.PowerShell.RunCommand.csproj (1 hunks)
  • Frends.PowerShell.RunCommand/Frends.PowerShell.RunCommand/PowerShell.cs (2 hunks)
  • Frends.PowerShell.RunScript/CHANGELOG.md (1 hunks)
  • Frends.PowerShell.RunScript/Frends.PowerShell.RunScript.Tests/UnitTests.cs (1 hunks)
  • Frends.PowerShell.RunScript/Frends.PowerShell.RunScript/Definitions/RunScriptInput.cs (1 hunks)
  • Frends.PowerShell.RunScript/Frends.PowerShell.RunScript/Frends.PowerShell.RunScript.csproj (1 hunks)
  • Frends.PowerShell.RunScript/Frends.PowerShell.RunScript/PowerShell.cs (3 hunks)
✅ Files skipped from review due to trivial changes (1)
  • Frends.PowerShell.RunScript/Frends.PowerShell.RunScript/Frends.PowerShell.RunScript.csproj
🧰 Additional context used
🪛 LanguageTool
Frends.PowerShell.RunScript/CHANGELOG.md

[duplication] ~4-~4: Possible typo: you repeated a word
Context: ... Changelog ## [1.3.0] - 2025-01-08 ### Added - Added option to run script using native Power...

(ENGLISH_WORD_REPEAT_RULE)

Frends.PowerShell.RunCommand/CHANGELOG.md

[duplication] ~4-~4: Possible typo: you repeated a word
Context: ... Changelog ## [1.3.0] - 2025-01-08 ### Added - Added option to run command using native Powe...

(ENGLISH_WORD_REPEAT_RULE)

⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Analyze (csharp)
  • GitHub Check: build / Build on windows-latest
  • GitHub Check: build / Build on windows-latest
🔇 Additional comments (4)
Frends.PowerShell.RunScript/CHANGELOG.md (1)

3-6: LGTM! Changelog entry aligns with PR objectives.

The changelog entry accurately reflects the PR's goal of enabling native PowerShell execution, maintaining consistency with similar changes in the Frends.PowerShell.RunCommand module.

🧰 Tools
🪛 LanguageTool

[duplication] ~4-~4: Possible typo: you repeated a word
Context: ... Changelog ## [1.3.0] - 2025-01-08 ### Added - Added option to run script using native Power...

(ENGLISH_WORD_REPEAT_RULE)

Frends.PowerShell.RunCommand/Frends.PowerShell.RunCommand.Tests/UnitTests.cs (1)

80-80: Verify native shell execution behavior

The ExecuteNativeShell flag is set but we should verify it actually uses the native PowerShell process.

✅ Verification successful

Native shell execution is properly implemented

The implementation correctly uses powershell.exe process when ExecuteNativeShell is true, with appropriate execution policy and profile settings. The code handles parameter passing, output/error capturing, and cleanup properly.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for the implementation to understand how native shell execution is handled
ast-grep --pattern 'ExecuteNativeShell = $_'

# Look for process creation or shell execution
rg -l 'Process|Shell|powershell.exe'

Length of output: 2388


Script:

#!/bin/bash
# Check the implementation in PowerShell.cs
cat "Frends.PowerShell.RunCommand/Frends.PowerShell.RunCommand/PowerShell.cs"

# Check RunOptions definition
cat "Frends.PowerShell.RunCommand/Frends.PowerShell.RunCommand/Definitions/RunOptions.cs"

Length of output: 7642

Frends.PowerShell.RunCommand/Frends.PowerShell.RunCommand/PowerShell.cs (1)

51-52: ⚠️ Potential issue

Parameters Not Passed to PowerShell Process

The parameterString is constructed but not included in the Arguments when starting the PowerShell process. As a result, the script may not receive the intended parameters.

Include parameterString in the Arguments to ensure parameters are passed correctly:

-Arguments = $"-NoProfile -ExecutionPolicy Bypass -File \"{scriptPath}\" ",
+Arguments = $"-NoProfile -ExecutionPolicy Bypass -File \"{scriptPath}\" {parameterString}",

Likely invalid or redundant comment.

Frends.PowerShell.RunScript/Frends.PowerShell.RunScript/PowerShell.cs (1)

75-76: Inconsistent Use of CreateNoWindow and UseShellExecute

When UseShellExecute is set to false, CreateNoWindow should typically be true. Verify if this is the intended behavior.

Ensure that the process window behavior aligns with the application's requirements.

Frends.PowerShell.RunScript/CHANGELOG.md Show resolved Hide resolved
Comment on lines +67 to +69
parameterString += $"-{param.Name} \"{param.Value}\" ";
}
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Potential Command Injection Risk in Parameter Concatenation

The parameters are concatenated into parameterString without proper sanitization, potentially leading to command injection vulnerabilities if param.Name or param.Value contain malicious input.

Properly escape or validate parameters before including them in the Arguments. Suggested fix:

 foreach (var param in parameters)
 {
-    parameterString += $"-{param.Name} \"{param.Value}\" ";
+    parameterString += $"-{EscapeArgument(param.Name)} {EscapeArgument(param.Value.ToString())} ";
 }

+string EscapeArgument(string argument)
+{
+    return "\"" + argument.Replace("\"", "`\"") + "\"";
+}

Committable suggestion skipped: line range outside the PR's diff.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

♻️ Duplicate comments (2)
Frends.PowerShell.RunCommand/Frends.PowerShell.RunCommand/PowerShell.cs (2)

44-51: ⚠️ Potential issue

Fix command injection vulnerability in parameter handling

Direct string concatenation of parameters creates a command injection vulnerability.

Replace the parameter handling with proper PowerShell parameter escaping:

-string parameterString = string.Empty;
-if (input.Parameters != null)
-{
-    foreach (var param in input.Parameters)
-    {
-        parameterString += $"-{param.Name} \"{param.Value}\" ";
-    }
-}
+var parameterString = input.Parameters == null ? string.Empty :
+    string.Join(" ", input.Parameters.Select(p => 
+        $"-{EscapeArgument(p.Name)} {EscapeArgument(p.Value?.ToString() ?? string.Empty)}"));

+private static string EscapeArgument(string value)
+{
+    if (string.IsNullOrEmpty(value)) return "\"\"";
+    // Escape any double quotes and wrap the entire string
+    return "\"" + value.Replace("\"", "`\"") + "\"";
+}

94-108: ⚠️ Potential issue

Add proper process cleanup and timeout handling

The process handling needs improvement to prevent resource leaks and handle long-running scripts.

Enhance the process execution with timeout and proper cleanup:

 try
 {
     process.Start();
     process.BeginOutputReadLine();
     process.BeginErrorReadLine();
-    process.WaitForExit();
+    // Add timeout handling (e.g., 5 minutes)
+    if (!process.WaitForExit(300000))
+    {
+        throw new TimeoutException("Script execution timed out after 5 minutes");
+    }
+    
+    if (process.ExitCode != 0)
+    {
+        errors.Add($"Script execution failed with exit code: {process.ExitCode}");
+    }
 }
 catch (Exception ex)
 {
     errors.Add($"Exception occurred while running the script: {ex.Message}");
 }
 finally
 {
+    try
+    {
+        if (!process.HasExited)
+        {
+            process.Kill(entireProcessTree: true);
+        }
+    }
+    catch (Exception ex)
+    {
+        errors.Add($"Failed to terminate process: {ex.Message}");
+    }
     process.Close();
 }
🧹 Nitpick comments (1)
Frends.PowerShell.RunCommand/Frends.PowerShell.RunCommand/PowerShell.cs (1)

74-75: Consider PowerShell Core compatibility

The code assumes Windows PowerShell by using powershell.exe.

Consider making the PowerShell executable path configurable to support both Windows PowerShell and PowerShell Core:

+private static string GetPowerShellPath()
+{
+    // Check for pwsh (PowerShell Core) first
+    var pwshPath = Path.Combine(
+        Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles),
+        "PowerShell", "7", "pwsh.exe");
+    return File.Exists(pwshPath) ? pwshPath : "powershell.exe";
+}

-FileName = "powershell.exe",
+FileName = GetPowerShellPath(),
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d1f2676 and e8578d9.

📒 Files selected for processing (2)
  • Frends.PowerShell.RunCommand/Frends.PowerShell.RunCommand.Tests/TaskUserInterfaceTests.cs (1 hunks)
  • Frends.PowerShell.RunCommand/Frends.PowerShell.RunCommand/PowerShell.cs (3 hunks)
✅ Files skipped from review due to trivial changes (1)
  • Frends.PowerShell.RunCommand/Frends.PowerShell.RunCommand.Tests/TaskUserInterfaceTests.cs
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: build / Code Quality Check
  • GitHub Check: build / Build on windows-latest
  • GitHub Check: Analyze (csharp)

@MatteoDelOmbra MatteoDelOmbra self-assigned this Jan 8, 2025
@MatteoDelOmbra MatteoDelOmbra requested a review from jefim January 8, 2025 07:47
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

♻️ Duplicate comments (9)
Frends.PowerShell.RunScript/Frends.PowerShell.RunScript/PowerShell.cs (3)

63-70: ⚠️ Potential issue

Security Risk: Unsafe Parameter Handling

The parameter string construction is vulnerable to command injection attacks.

Previous review already suggested proper parameter escaping. Please implement the suggested fix to prevent command injection vulnerabilities.


72-81: ⚠️ Potential issue

Cross-Platform Compatibility Issue

The hardcoded powershell.exe filename won't work on Linux systems where the executable is typically pwsh.

Add platform-specific executable selection:

- FileName = "powershell.exe",
+ FileName = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "powershell.exe" : "pwsh",

Don't forget to add:

using System.Runtime.InteropServices;

83-93: ⚠️ Potential issue

Resource Leak: Event Handler Cleanup

Event handlers should be unwired in the finally block to prevent memory leaks.

Refactor the code to properly clean up event handlers:

 try
 {
     process.Start();
     process.BeginOutputReadLine();
     process.BeginErrorReadLine();
     process.WaitForExit();
 }
 catch (Exception ex)
 {
     errors.Add($"Exception occurred while running the script: {ex.Message}");
 }
 finally
 {
+    process.OutputDataReceived -= outputHandler;
+    process.ErrorDataReceived -= errorHandler;
     if (!process.HasExited) process.Kill();
     process.Close();
 }

Move the event handler declarations outside the registration:

DataReceivedEventHandler outputHandler = (sender, args) =>
{
    if (!string.IsNullOrWhiteSpace(args.Data))
        results.Add(args.Data);
};
process.OutputDataReceived += outputHandler;

DataReceivedEventHandler errorHandler = (sender, args) =>
{
    if (!string.IsNullOrWhiteSpace(args.Data))
        errors.Add(args.Data);
};
process.ErrorDataReceived += errorHandler;

Also applies to: 95-110

.github/workflows/RunCommand_build_and_test_on_push.yml (1)

10-11: ⚠️ Potential issue

Fix workflow_dispatch trigger syntax

Same issue as in RunScript workflow - the workflow_dispatch event trigger doesn't support path filters.

Apply this diff to fix the workflow syntax:

  workflow_dispatch:
-   paths:
-     - "Frends.PowerShell.RunCommand/**"
🧰 Tools
🪛 actionlint (1.7.4)

10-10: expected "inputs" key for "workflow_dispatch" section but got "paths"

(syntax-check)

Frends.PowerShell.RunCommand/Frends.PowerShell.RunCommand/PowerShell.cs (5)

41-43: ⚠️ Potential issue

Improve temporary file security and cleanup

The temporary file handling needs improvement to prevent race conditions and ensure secure cleanup:

  1. Use secure file creation with restricted access
  2. Consider using FileOptions.DeleteOnClose
  3. Implement proper error handling for file operations

Previous review comment about improving temporary file security is still valid. Additionally, ensure proper error handling for file operations:

-var tempScript = Path.Combine(Path.GetTempPath(), $"{Path.GetRandomFileName()}.ps1");
-try
-{
+string tempScript = null;
+try
+{
+    // Create temp file with restricted access
+    tempScript = Path.Combine(Path.GetTempPath(), $"{Path.GetRandomFileName()}.ps1");
+    using (var fs = new FileStream(tempScript, FileMode.CreateNew, 
+           FileAccess.Write, FileShare.None, 
+           4096, FileOptions.DeleteOnClose | FileOptions.Encrypted))
+    using (var sw = new StreamWriter(fs, Encoding.UTF8))
+    {
+        sw.Write($"{input.Command} {parameterString}");
+    }

Also applies to: 57-58


44-52: ⚠️ Potential issue

Fix command injection vulnerability in parameter handling

The current parameter concatenation is vulnerable to command injection attacks. Parameters need proper escaping.

Previous review comment about parameter escaping is still valid. Additionally:

  1. Consider using PowerShell's native parameter binding
  2. Implement proper parameter validation
-    string parameterString = string.Empty;
-    if (input.Parameters != null)
-    {
-        foreach (var param in input.Parameters)
-        {
-            parameterString += $"-{param.Name} \"{param.Value}\" ";
-        }
-    }
-    File.WriteAllText(tempScript, $"{input.Command} {parameterString}", Encoding.UTF8);
+    var sb = new StringBuilder();
+    sb.Append(EscapeCommand(input.Command));
+    if (input.Parameters != null)
+    {
+        foreach (var param in input.Parameters)
+        {
+            if (string.IsNullOrWhiteSpace(param.Name))
+                throw new ArgumentException("Parameter name cannot be empty");
+            sb.Append(' ').Append('-').Append(EscapeParameterName(param.Name));
+            if (param.Value != null)
+                sb.Append(' ').Append(EscapeParameterValue(param.Value.ToString()));
+        }
+    }
+    await File.WriteAllTextAsync(tempScript, sb.ToString(), new UTF8Encoding(false));
+
+private static string EscapeCommand(string command) =>
+    string.IsNullOrWhiteSpace(command)
+        ? throw new ArgumentException("Command cannot be empty")
+        : command.Replace("\"", "`\"").Replace(";", "`;");
+
+private static string EscapeParameterName(string name) =>
+    name.TrimStart('-').Replace("\"", "").Replace(";", "");
+
+private static string EscapeParameterValue(string value) =>
+    $"\"{value.Replace("\"", "`\"").Replace(";", "`;")}\"";

74-80: ⚠️ Potential issue

Improve process security and cross-platform support

The process configuration needs security enhancements and cross-platform support:

  1. Platform-specific executable name
  2. Working directory handling
  3. Environment isolation

Previous review comments about process configuration and platform support are still valid. Additionally:

+    private static string GetPowerShellExecutable() =>
+        OperatingSystem.IsWindows() ? "powershell.exe" : "pwsh";

     process.StartInfo = new()
     {
-        FileName = "powershell.exe",
+        FileName = GetPowerShellExecutable(),
         Arguments = $"-NoProfile -ExecutionPolicy Bypass -File \"{scriptPath}\" ",
         UseShellExecute = false,
         CreateNoWindow = true,
         RedirectStandardError = true,
         RedirectStandardOutput = true,
+        WorkingDirectory = Path.GetDirectoryName(scriptPath),
+        LoadUserProfile = false,
     };
+    // Prevent injection via environment variables
+    process.StartInfo.Environment.Clear();
+    process.StartInfo.Environment["PSModulePath"] = string.Empty;

66-67: 🛠️ Refactor suggestion

Add bounds to result collections

Unbounded collections could lead to memory issues with large output.

Previous review comment about adding bounds to result collections is still valid.


82-92: ⚠️ Potential issue

Improve event handler cleanup and process management

Event handlers need to be properly unwired to prevent memory leaks, and process cleanup needs to be robust.

Previous review comment about event handler cleanup is still valid. Additionally:

+    DataReceivedEventHandler outputHandler = null;
+    DataReceivedEventHandler errorHandler = null;
+    try
+    {
+        outputHandler = (sender, args) =>
+        {
+            if (!string.IsNullOrWhiteSpace(args.Data))
+                results.Add(args.Data);
+        };
+        errorHandler = (sender, args) =>
+        {
+            if (!string.IsNullOrWhiteSpace(args.Data))
+                errors.Add(args.Data);
+        };
+        
+        process.OutputDataReceived += outputHandler;
+        process.ErrorDataReceived += errorHandler;
         // ... rest of the process execution ...
     }
     finally
     {
+        if (outputHandler != null)
+            process.OutputDataReceived -= outputHandler;
+        if (errorHandler != null)
+            process.ErrorDataReceived -= errorHandler;
         if (!process.HasExited) process.Kill();
         process.Close();
     }

Also applies to: 105-109

🧹 Nitpick comments (1)
Frends.PowerShell.RunScript/Frends.PowerShell.RunScript/PowerShell.cs (1)

112-112: Inconsistent Logging Between Execution Modes

The native shell execution mode returns an empty string for the Log property, while the managed execution mode includes information stream logs. This inconsistency might affect monitoring and debugging capabilities.

Consider capturing and returning the complete console output as the log string:

- return new PowerShellResult(results, errors, string.Empty);
+ var log = string.Join("\n", results.Concat(errors));
+ return new PowerShellResult(results, errors, log);
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e8578d9 and ce29d06.

📒 Files selected for processing (6)
  • .github/workflows/RunCommand_build_and_test_on_push.yml (1 hunks)
  • .github/workflows/RunScript_build_and_test_on_push.yml (1 hunks)
  • Frends.PowerShell.RunCommand/Frends.PowerShell.RunCommand/PowerShell.cs (3 hunks)
  • Frends.PowerShell.RunScript/Frends.PowerShell.RunScript.Tests/TaskUserInterfaceTests.cs (1 hunks)
  • Frends.PowerShell.RunScript/Frends.PowerShell.RunScript.Tests/UnitTests.cs (1 hunks)
  • Frends.PowerShell.RunScript/Frends.PowerShell.RunScript/PowerShell.cs (3 hunks)
✅ Files skipped from review due to trivial changes (1)
  • Frends.PowerShell.RunScript/Frends.PowerShell.RunScript.Tests/TaskUserInterfaceTests.cs
🚧 Files skipped from review as they are similar to previous changes (1)
  • Frends.PowerShell.RunScript/Frends.PowerShell.RunScript.Tests/UnitTests.cs
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/RunScript_build_and_test_on_push.yml

10-10: expected "inputs" key for "workflow_dispatch" section but got "paths"

(syntax-check)

.github/workflows/RunCommand_build_and_test_on_push.yml

10-10: expected "inputs" key for "workflow_dispatch" section but got "paths"

(syntax-check)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Analyze (csharp)
🔇 Additional comments (4)
Frends.PowerShell.RunScript/Frends.PowerShell.RunScript/PowerShell.cs (1)

46-49: LGTM! Clean implementation of the execution mode switch.

The conditional logic clearly separates the two execution paths while maintaining proper cleanup of temporary files.

.github/workflows/RunScript_build_and_test_on_push.yml (2)

14-20: LGTM! Clear job naming for Windows build

The rename from build to build-windows improves clarity now that we're supporting multiple platforms.


21-27: Verify Linux workflow file existence

The addition of Linux support is good, but we need to ensure the referenced workflow file exists.

✅ Verification successful

Linux workflow file verified successfully

The referenced workflow file exists in the FrendsPlatform/FrendsTasks repository and is compatible with all the required parameters and secrets being passed.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if the referenced workflow file exists in the FrendsPlatform/FrendsTasks repository
gh api \
  -H "Accept: application/vnd.github+json" \
  repos/FrendsPlatform/FrendsTasks/contents/.github/workflows/linux_build_test.yml

Length of output: 14590

.github/workflows/RunCommand_build_and_test_on_push.yml (1)

14-20: LGTM! Consistent multi-platform support

The changes mirror those in the RunScript workflow, maintaining consistency across both PowerShell modules:

  • Clear Windows/Linux job naming
  • Same workflow file references
  • Consistent secret usage

Also applies to: 21-27

Comment on lines 10 to +11
paths:
- 'Frends.PowerShell.RunScript/**'

- "Frends.PowerShell.RunScript/**"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix workflow_dispatch trigger syntax

The workflow_dispatch event trigger doesn't support path filters. These should be moved to inputs if manual input is needed, or removed if not required.

Apply this diff to fix the workflow syntax:

  workflow_dispatch:
-   paths:
-     - "Frends.PowerShell.RunScript/**"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
paths:
- 'Frends.PowerShell.RunScript/**'
- "Frends.PowerShell.RunScript/**"
workflow_dispatch:
🧰 Tools
🪛 actionlint (1.7.4)

10-10: expected "inputs" key for "workflow_dispatch" section but got "paths"

(syntax-check)

Comment on lines +94 to +104
try
{
process.Start();
process.BeginOutputReadLine();
process.BeginErrorReadLine();
process.WaitForExit();
}
catch (Exception ex)
{
errors.Add($"Exception occurred while running the script: {ex.Message}");
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Improve error handling and process timeout

The process execution needs timeout handling and better error reporting.

+    using var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); // 5-minute timeout
     try
     {
         process.Start();
         process.BeginOutputReadLine();
         process.BeginErrorReadLine();
-        process.WaitForExit();
+        if (!process.WaitForExit(300000)) // 5-minute timeout
+        {
+            throw new TimeoutException("Process execution timed out after 5 minutes");
+        }
+        if (process.ExitCode != 0)
+        {
+            throw new Exception($"Process exited with code {process.ExitCode}");
+        }
     }
     catch (Exception ex)
     {
-        errors.Add($"Exception occurred while running the script: {ex.Message}");
+        errors.Add($"Exception occurred while running the script: {ex.GetType().Name}: {ex.Message}");
+        if (ex is TimeoutException)
+        {
+            process.Kill(entireProcessTree: true);
+        }
     }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
try
{
process.Start();
process.BeginOutputReadLine();
process.BeginErrorReadLine();
process.WaitForExit();
}
catch (Exception ex)
{
errors.Add($"Exception occurred while running the script: {ex.Message}");
}
using var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); // 5-minute timeout
try
{
process.Start();
process.BeginOutputReadLine();
process.BeginErrorReadLine();
if (!process.WaitForExit(300000)) // 5-minute timeout
{
throw new TimeoutException("Process execution timed out after 5 minutes");
}
if (process.ExitCode != 0)
{
throw new Exception($"Process exited with code {process.ExitCode}");
}
}
catch (Exception ex)
{
errors.Add($"Exception occurred while running the script: {ex.GetType().Name}: {ex.Message}");
if (ex is TimeoutException)
{
process.Kill(entireProcessTree: true);
}
}

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (7)
Frends.PowerShell.RunCommand/Frends.PowerShell.RunCommand/PowerShell.cs (4)

40-44: ⚠️ Potential issue

Add input validation before script creation.

The code should validate the input before creating temporary files to prevent security issues.

Apply input validation at the start of the conditional block:

 if (input.ExecuteNativeShell)
 {
+    if (string.IsNullOrWhiteSpace(input.Command))
+        throw new ArgumentException("Command cannot be empty when executing from native shell");
+    if (input.Parameters?.Any(p => string.IsNullOrWhiteSpace(p.Name)) == true)
+        throw new ArgumentException("Parameter names cannot be empty");
     var tempScript = Path.Combine(Path.GetTempPath(), $"{Path.GetRandomFileName()}.ps1");

45-54: ⚠️ Potential issue

Fix command injection vulnerability and improve temporary file security.

The current implementation has two security issues:

  1. Parameters are concatenated without proper escaping
  2. Temporary file creation is not secure

Apply these security improvements:

-    string parameterString = string.Empty;
-    if (input.Parameters != null)
-    {
-        foreach (var param in input.Parameters)
-        {
-            parameterString += $"-{param.Name} \"{param.Value}\" ";
-        }
-    }
-    File.WriteAllText(tempScript, $"{input.Command} {parameterString}", Encoding.UTF8);
+    string parameterString = input.Parameters == null ? string.Empty :
+        string.Join(" ", input.Parameters.Select(p => 
+            $"-{EscapeArgument(p.Name)} {EscapeArgument(p.Value?.ToString() ?? string.Empty)}"));
+    
+    using (var fs = new FileStream(tempScript, FileMode.CreateNew, 
+           FileAccess.Write, FileShare.None, 
+           4096, FileOptions.DeleteOnClose | FileOptions.Encrypted))
+    using (var sw = new StreamWriter(fs, Encoding.UTF8))
+    {
+        sw.Write($"{input.Command} {parameterString}");
+    }

+private static string EscapeArgument(string argument)
+{
+    return "\"" + argument.Replace("\"", "`\"") + "\"";
+}

70-79: 🛠️ Refactor suggestion

Improve process configuration and security.

The process configuration needs additional security settings and proper working directory handling.

 using Process process = new();
 process.StartInfo = new()
 {
     FileName = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "powershell" : "pwsh",
     Arguments = $"-NoProfile -ExecutionPolicy Bypass -File \"{scriptPath}\" ",
     UseShellExecute = false,
     CreateNoWindow = true,
     RedirectStandardError = true,
     RedirectStandardOutput = true,
+    WorkingDirectory = Path.GetDirectoryName(scriptPath),
+    // Prevent injection via environment variables
+    LoadUserProfile = false,
+    Environment = { ["PSModulePath"] = string.Empty },
 };

94-104: 🛠️ Refactor suggestion

Add process timeout handling.

The process execution needs timeout handling to prevent hanging.

+    using var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); // 5-minute timeout
     try
     {
         process.Start();
         process.BeginOutputReadLine();
         process.BeginErrorReadLine();
-        process.WaitForExit();
+        if (!process.WaitForExit(300000)) // 5-minute timeout
+        {
+            throw new TimeoutException("Process execution timed out after 5 minutes");
+        }
+        if (process.ExitCode != 0)
+        {
+            throw new Exception($"Process exited with code {process.ExitCode}");
+        }
     }
Frends.PowerShell.RunScript/Frends.PowerShell.RunScript/PowerShell.cs (3)

64-71: ⚠️ Potential issue

Fix command injection vulnerability in parameter handling.

The parameter concatenation is vulnerable to command injection.

-    string parameterString = string.Empty;
-    if (parameters != null)
-    {
-        foreach (var param in parameters)
-        {
-            parameterString += $"-{param.Name} \"{param.Value}\" ";
-        }
-    }
+    string parameterString = parameters == null ? string.Empty :
+        string.Join(" ", parameters.Select(p => 
+            $"-{EscapeArgument(p.Name)} {EscapeArgument(p.Value?.ToString() ?? string.Empty)}"));

+private static string EscapeArgument(string argument)
+{
+    return "\"" + argument.Replace("\"", "`\"") + "\"";
+}

73-82: 🛠️ Refactor suggestion

Apply consistent process configuration improvements.

Apply the same process configuration improvements as suggested for RunCommand.

 process.StartInfo = new()
 {
     FileName = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "powershell" : "pwsh",
     Arguments = $"-NoProfile -ExecutionPolicy Bypass -File \"{scriptPath}\" {parameterString}",
     UseShellExecute = false,
     CreateNoWindow = true,
     RedirectStandardError = true,
     RedirectStandardOutput = true,
+    WorkingDirectory = Path.GetDirectoryName(scriptPath),
+    LoadUserProfile = false,
+    Environment = { ["PSModulePath"] = string.Empty },
 };

97-107: 🛠️ Refactor suggestion

Add timeout handling and improve error handling.

Add timeout handling and improve error reporting for consistency with RunCommand.

+    using var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5));
     try
     {
         process.Start();
         process.BeginOutputReadLine();
         process.BeginErrorReadLine();
-        process.WaitForExit();
+        if (!process.WaitForExit(300000))
+        {
+            throw new TimeoutException("Process execution timed out after 5 minutes");
+        }
+        if (process.ExitCode != 0)
+        {
+            throw new Exception($"Process exited with code {process.ExitCode}");
+        }
     }
     catch (Exception ex)
     {
-        errors.Add($"Exception occurred while running the script: {ex.Message}");
+        errors.Add($"Exception occurred while running the script: {ex.GetType().Name}: {ex.Message}");
+        if (ex is TimeoutException)
+        {
+            process.Kill(entireProcessTree: true);
+        }
     }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ce29d06 and 2995ef4.

📒 Files selected for processing (2)
  • Frends.PowerShell.RunCommand/Frends.PowerShell.RunCommand/PowerShell.cs (3 hunks)
  • Frends.PowerShell.RunScript/Frends.PowerShell.RunScript/PowerShell.cs (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (7)
  • GitHub Check: build-windows / Code Quality Check
  • GitHub Check: build-windows / Code Quality Check
  • GitHub Check: build-linux / Code Quality Check
  • GitHub Check: build-windows / Build on windows-latest
  • GitHub Check: build-windows / Build on windows-latest
  • GitHub Check: build-linux / Code Quality Check
  • GitHub Check: Analyze (csharp)
🔇 Additional comments (1)
Frends.PowerShell.RunCommand/Frends.PowerShell.RunCommand/PowerShell.cs (1)

67-68: Add bounds to result collections.

The unbounded collections could lead to memory issues with large output.

-List<dynamic> results = new();
-List<string> errors = new();
+const int MaxResults = 10000;
+List<dynamic> results = new(MaxResults);
+List<string> errors = new(100);
+int skippedResults = 0;

Comment on lines +47 to +50
if (input.ExecuteNativeShell)
return ExecuteProcess(tempScript, input.Parameters);
else
return ExecuteCommand(tempScript, input.Parameters, input.LogInformationStream, session.PowerShell, cancellationToken);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Align security improvements with RunCommand.

For consistency and security, apply the same improvements as suggested for the RunCommand implementation:

  1. Add input validation
  2. Use secure file creation
  3. Escape parameters properly
+            if (input.ExecuteNativeShell)
+            {
+                if (string.IsNullOrWhiteSpace(script))
+                    throw new ArgumentException("Script cannot be empty when executing from native shell");
+                if (input.Parameters?.Any(p => string.IsNullOrWhiteSpace(p.Name)) == true)
+                    throw new ArgumentException("Parameter names cannot be empty");
+            }
             File.WriteAllText(tempScript, script, Encoding.UTF8);
             if (input.ExecuteNativeShell)
                 return ExecuteProcess(tempScript, input.Parameters);

Committable suggestion skipped: line range outside the PR's diff.

@MatteoDelOmbra MatteoDelOmbra requested a review from jefim January 9, 2025 06:46
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

♻️ Duplicate comments (5)
Frends.PowerShell.RunCommand/Frends.PowerShell.RunCommand/PowerShell.cs (5)

40-44: ⚠️ Potential issue

Add input validation for command and parameters

The command and parameters should be validated before execution to prevent security issues.

Add validation at the start of the conditional block:

 if (input.ExecuteNativeShell)
 {
+    if (string.IsNullOrWhiteSpace(input.Command))
+        throw new ArgumentException("Command cannot be empty when executing from native shell");
+    if (input.Parameters?.Any(p => string.IsNullOrWhiteSpace(p.Name)) == true)
+        throw new ArgumentException("Parameter names cannot be empty");
     var tempScript = Path.Combine(Path.GetTempPath(), $"{Path.GetRandomFileName()}.ps1");

45-52: ⚠️ Potential issue

Fix potential command injection vulnerability

The current parameter concatenation is vulnerable to command injection attacks.

Apply this fix:

-    string parameterString = string.Empty;
-    if (input.Parameters != null)
-    {
-        foreach (var param in input.Parameters)
-        {
-            parameterString += $"-{param.Name} \"{param.Value}\" ";
-        }
-    }
+    var parameterString = input.Parameters == null ? string.Empty :
+        string.Join(" ", input.Parameters.Select(p => 
+            $"-{EscapeArgument(p.Name)} {EscapeArgument(p.Value?.ToString() ?? string.Empty)}"));

+private static string EscapeArgument(string argument)
+{
+    if (string.IsNullOrEmpty(argument)) return "\"\"";
+    return "\"" + argument.Replace("\"", "`\"").Replace("$", "`$") + "\"";
+}

70-79: ⚠️ Potential issue

Enhance process security configuration

The process configuration needs additional security settings and proper working directory handling.

 process.StartInfo = new()
 {
     FileName = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "powershell" : "pwsh",
     Arguments = $"-NoProfile -ExecutionPolicy Bypass -File \"{scriptPath}\" ",
     UseShellExecute = false,
     CreateNoWindow = true,
     RedirectStandardError = true,
     RedirectStandardOutput = true,
+    WorkingDirectory = Path.GetDirectoryName(scriptPath),
+    // Prevent injection via environment variables
+    LoadUserProfile = false,
+    Environment = { ["PSModulePath"] = string.Empty },
 };

67-68: 🛠️ Refactor suggestion

Add bounds to result collections

The unbounded collections could lead to memory issues with large output.

-List<dynamic> results = new();
-List<string> errors = new();
+const int MaxResults = 10000;
+List<dynamic> results = new(MaxResults);
+List<string> errors = new(100);
+int skippedResults = 0;

// Later in the ProcessOutputReceiver:
-if (!string.IsNullOrWhiteSpace(args.Data))
+if (!string.IsNullOrWhiteSpace(args.Data) && results.Count < MaxResults)
     results.Add(args.Data);
+else if (!string.IsNullOrWhiteSpace(args.Data))
+    skippedResults++;

94-104: 🛠️ Refactor suggestion

Add process execution timeout

Long-running processes could block indefinitely. Add a timeout mechanism.

+using var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); // 5-minute timeout
 try
 {
     process.Start();
     process.BeginOutputReadLine();
     process.BeginErrorReadLine();
-    process.WaitForExit();
+    if (!process.WaitForExit(300000)) // 5-minute timeout
+    {
+        throw new TimeoutException("Process execution timed out after 5 minutes");
+    }
+    if (process.ExitCode != 0)
+    {
+        throw new Exception($"Process exited with code {process.ExitCode}");
+    }
 }
🧹 Nitpick comments (1)
Frends.PowerShell.RunCommand/Frends.PowerShell.RunCommand/PowerShell.cs (1)

73-73: Document platform-specific executable names

Add XML documentation to explain the executable names used on different platforms.

+/// <summary>
+/// The PowerShell executable name is platform-specific:
+/// - Windows: "powershell"
+/// - Linux/macOS: "pwsh"
+/// </summary>
 FileName = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "powershell" : "pwsh",
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 46d4f5f and cb7633f.

📒 Files selected for processing (1)
  • Frends.PowerShell.RunCommand/Frends.PowerShell.RunCommand/PowerShell.cs (3 hunks)
🔇 Additional comments (1)
Frends.PowerShell.RunCommand/Frends.PowerShell.RunCommand/PowerShell.cs (1)

3-3: LGTM: Required imports added for native shell execution

The new imports support process handling and cross-platform compatibility.

Also applies to: 8-8, 9-9, 10-10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Frends.PowerShell.RunScript and RunCommand investigations for running more complex scripts
2 participants