diff --git a/Heleonix.Execution/.manifest b/Heleonix.Execution/.manifest
index aa19947..a772667 100644
--- a/Heleonix.Execution/.manifest
+++ b/Heleonix.Execution/.manifest
@@ -16,6 +16,7 @@
"Heleonix.Execution.ArgsBuilder.op_Implicit(Heleonix.Execution.ArgsBuilder)~System.String": "Heleonix.Execution.ArgsBuilder.yml",
"Heleonix.Execution.ExeHelper": "Heleonix.Execution.ExeHelper.yml",
"Heleonix.Execution.ExeHelper.Execute(System.String,System.String,System.Boolean,System.String,System.Int32)": "Heleonix.Execution.ExeHelper.yml",
+ "Heleonix.Execution.ExeHelper.Execute(System.String,System.String,System.IO.TextWriter,System.IO.TextWriter,System.String,System.Int32,System.Int32)": "Heleonix.Execution.ExeHelper.yml",
"Heleonix.Execution.ExeHelper.Execute(System.String,System.String,System.String)": "Heleonix.Execution.ExeHelper.yml",
"Heleonix.Execution.ExeResult": "Heleonix.Execution.ExeResult.yml",
"Heleonix.Execution.ExeResult.#ctor": "Heleonix.Execution.ExeResult.yml",
diff --git a/Heleonix.Execution/Heleonix.Execution.ExeHelper.yml b/Heleonix.Execution/Heleonix.Execution.ExeHelper.yml
index 2f0b323..badb60f 100644
--- a/Heleonix.Execution/Heleonix.Execution.ExeHelper.yml
+++ b/Heleonix.Execution/Heleonix.Execution.ExeHelper.yml
@@ -6,6 +6,7 @@ items:
parent: Heleonix.Execution
children:
- Heleonix.Execution.ExeHelper.Execute(System.String,System.String,System.Boolean,System.String,System.Int32)
+ - Heleonix.Execution.ExeHelper.Execute(System.String,System.String,System.IO.TextWriter,System.IO.TextWriter,System.String,System.Int32,System.Int32)
- Heleonix.Execution.ExeHelper.Execute(System.String,System.String,System.String)
langs:
- csharp
@@ -49,7 +50,7 @@ items:
summary: Executes an executable by the specified exePath.
example:
- >-
- var result = ExeHelper.Execute(
+
var result = ExeHelper.Execute(
@"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe",
@@ -66,28 +67,26 @@ items:
Console.WriteLine(result.Output); // Output like `Console.WriteLine` is available here
- Console.WriteLine(result.Error); // Output like `Console.Error.WriteLine` is available here.
+ Console.WriteLine(result.Error); // Output like `Console.Error.WriteLine` is available here.
syntax:
content: public static ExeResult Execute(string exePath, string arguments, bool extractOutput, string workingDirectory = "", int waitForExit = 2147483647)
parameters:
- id: exePath
type: System.String
- description: Defines the path to executable.
+ description: The path to the executable file to run.
- id: arguments
type: System.String
- description: Represents the command line arguments.
+ description: Command line arguments to pass into the executable.
- id: extractOutput
type: System.Boolean
description: Defines whether to redirect and extract standard output and errors or not.
- id: workingDirectory
type: System.String
- description: >-
- The current working directory.
- Relative paths inside the executable will be relative to this working directory.
+ description: The working directory to launch the executable in.
- id: waitForExit
type: System.Int32
description: >-
- A number of millisecoonds to wait for process ending.
+ A number of millisecoonds to wait for the process ending.
Use exePath. Does not extract output and error streams.
example: []
syntax:
content: public static int Execute(string exePath, string arguments, string workingDirectory = "")
parameters:
- id: exePath
type: System.String
- description: The execute path.
+ description: The path to the executable file to run.
- id: arguments
type: System.String
- description: The arguments.
+ description: Command line arguments to pass into the executable.
- id: workingDirectory
type: System.String
- description: The working directory.
+ description: The working directory to launch the executable in.
return:
type: System.Int32
- description: An executable's exit code.
+ description: The exit code of the executable.
content.vb: Public Shared Function Execute(exePath As String, arguments As String, workingDirectory As String = "") As Integer
overload: Heleonix.Execution.ExeHelper.Execute*
exceptions:
- type: System.InvalidOperationException
commentId: T:System.InvalidOperationException
- description: See the inner exception for details.
+ description: See the inner exception for more details.
nameWithType.vb: ExeHelper.Execute(String, String, String)
fullName.vb: Heleonix.Execution.ExeHelper.Execute(String, String, String)
name.vb: Execute(String, String, String)
+- uid: Heleonix.Execution.ExeHelper.Execute(System.String,System.String,System.IO.TextWriter,System.IO.TextWriter,System.String,System.Int32,System.Int32)
+ commentId: M:Heleonix.Execution.ExeHelper.Execute(System.String,System.String,System.IO.TextWriter,System.IO.TextWriter,System.String,System.Int32,System.Int32)
+ id: Execute(System.String,System.String,System.IO.TextWriter,System.IO.TextWriter,System.String,System.Int32,System.Int32)
+ parent: Heleonix.Execution.ExeHelper
+ langs:
+ - csharp
+ - vb
+ name: Execute(string, string, TextWriter, TextWriter, string, int, int)
+ nameWithType: ExeHelper.Execute(string, string, TextWriter, TextWriter, string, int, int)
+ fullName: Heleonix.Execution.ExeHelper.Execute(string, string, System.IO.TextWriter, System.IO.TextWriter, string, int, int)
+ type: Method
+ assemblies:
+ - Heleonix.Execution
+ namespace: Heleonix.Execution
+ summary: >-
+ Executes an executable by the specified exePath.
+
+ Asynchronously forwards outputWriter and errorWriter using
+
+ the intermediate char buffer with the specified bufferSize.
+ example:
+ - >-
+ Launch an executable and forward its output and error streams while it is running.
+
+ var output = new StringWriter();
+
+ var error = new StringWriter();
+
+
+ var exitCode = ExeHelper.Execute("dotnet.exe", "--UNKNOWN", output, error, string.Empty, 5000, 2048);
+
+
+ var o = output.ToString();
+
+ var e = error.ToString();
+
+ Launch an executable and forward its output and error streams to the var exitCode = ExeHelper.Execute("dotnet.exe", "--UNKNOWN", Console.Out, Console.Error, string.Empty, 5000, 2048);
+ syntax:
+ content: public static int Execute(string exePath, string arguments, TextWriter outputWriter, TextWriter errorWriter, string workingDirectory = "", int waitForExit = 2147483647, int bufferSize = 4096)
+ parameters:
+ - id: exePath
+ type: System.String
+ description: The path to the executable file to run.
+ - id: arguments
+ type: System.String
+ description: Command line arguments to pass into the executable.
+ - id: outputWriter
+ type: System.IO.TextWriter
+ description: The text writer to forward the standard output stream to.
+ - id: errorWriter
+ type: System.IO.TextWriter
+ description: The text writer to forward the standard error stream to.
+ - id: workingDirectory
+ type: System.String
+ description: The working directory to launch the executable in.
+ - id: waitForExit
+ type: System.Int32
+ description: >-
+ A number of millisecoonds to wait for the process ending.
+ Use char.
+ return:
+ type: System.Int32
+ description: The exit code of the executable.
+ content.vb: Public Shared Function Execute(exePath As String, arguments As String, outputWriter As TextWriter, errorWriter As TextWriter, workingDirectory As String = "", waitForExit As Integer = 2147483647, bufferSize As Integer = 4096) As Integer
+ overload: Heleonix.Execution.ExeHelper.Execute*
+ exceptions:
+ - type: System.InvalidOperationException
+ commentId: T:System.InvalidOperationException
+ description: See the inner exception for more details.
+ nameWithType.vb: ExeHelper.Execute(String, String, TextWriter, TextWriter, String, Integer, Integer)
+ fullName.vb: Heleonix.Execution.ExeHelper.Execute(String, String, System.IO.TextWriter, System.IO.TextWriter, String, Integer, Integer)
+ name.vb: Execute(String, String, TextWriter, TextWriter, String, Integer, Integer)
references:
- uid: Heleonix.Execution
commentId: N:Heleonix.Execution
@@ -470,3 +548,59 @@ references:
name: ExeResult
nameWithType: ExeResult
fullName: Heleonix.Execution.ExeResult
+- uid: System.Diagnostics.Process.StandardOutput
+ commentId: P:System.Diagnostics.Process.StandardOutput
+ isExternal: true
+ href: https://learn.microsoft.com/dotnet/api/system.diagnostics.process.standardoutput
+ name: StandardOutput
+ nameWithType: Process.StandardOutput
+ fullName: System.Diagnostics.Process.StandardOutput
+- uid: System.Diagnostics.Process.StandardError
+ commentId: P:System.Diagnostics.Process.StandardError
+ isExternal: true
+ href: https://learn.microsoft.com/dotnet/api/system.diagnostics.process.standarderror
+ name: StandardError
+ nameWithType: Process.StandardError
+ fullName: System.Diagnostics.Process.StandardError
+- uid: System.Console
+ commentId: T:System.Console
+ isExternal: true
+ href: https://learn.microsoft.com/dotnet/api/system.console
+ name: Console
+ nameWithType: Console
+ fullName: System.Console
+- uid: System.IO.TextWriter
+ commentId: T:System.IO.TextWriter
+ parent: System.IO
+ isExternal: true
+ href: https://learn.microsoft.com/dotnet/api/system.io.textwriter
+ name: TextWriter
+ nameWithType: TextWriter
+ fullName: System.IO.TextWriter
+- uid: System.IO
+ commentId: N:System.IO
+ isExternal: true
+ href: https://learn.microsoft.com/dotnet/api/system
+ name: System.IO
+ nameWithType: System.IO
+ fullName: System.IO
+ spec.csharp:
+ - uid: System
+ name: System
+ isExternal: true
+ href: https://learn.microsoft.com/dotnet/api/system
+ - name: .
+ - uid: System.IO
+ name: IO
+ isExternal: true
+ href: https://learn.microsoft.com/dotnet/api/system.io
+ spec.vb:
+ - uid: System
+ name: System
+ isExternal: true
+ href: https://learn.microsoft.com/dotnet/api/system
+ - name: .
+ - uid: System.IO
+ name: IO
+ isExternal: true
+ href: https://learn.microsoft.com/dotnet/api/system.io
diff --git a/docs/Heleonix.Execution/Heleonix.Execution.ExeHelper.html b/docs/Heleonix.Execution/Heleonix.Execution.ExeHelper.html
index 31f47a3..51a8470 100644
--- a/docs/Heleonix.Execution/Heleonix.Execution.ExeHelper.html
+++ b/docs/Heleonix.Execution/Heleonix.Execution.ExeHelper.html
@@ -171,20 +171,19 @@ exePath stringDefines the path to executable.
+The path to the executable file to run.
arguments stringRepresents the command line arguments.
+Command line arguments to pass into the executable.
extractOutput boolDefines whether to redirect and extract standard output and errors or not.
workingDirectory stringThe current working directory. -Relative paths inside the executable will be relative to this working directory.
+The working directory to launch the executable in.
waitForExit intA number of millisecoonds to wait for process ending. +
A number of millisecoonds to wait for the process ending. Use MaxValue to wait infinitely.
var result = ExeHelper.Execute( -@"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe", -"--app=http://www.google.com --window-size=300,300 --new-window", +
var result = ExeHelper.Execute(
+@"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe",
+"--app=http://www.google.com --window-size=300,300 --new-window",
true,
string.Empty,
-2000);
-Console.WriteLine(result.ExitCode); // An exit code: value returned by Main or by Environment.Exit(exitCode) etc.
-Console.WriteLine(result.Output); // Output like Console.WriteLine is available here
-Console.WriteLine(result.Error); // Output like Console.Error.WriteLine is available here.
+2000);
+
+Console.WriteLine(result.ExitCode); // An exit code: value returned by `Main` or by `Environment.Exit(exitCode)` etc.
+Console.WriteLine(result.Output); // Output like `Console.WriteLine` is available here
+Console.WriteLine(result.Error); // Output like `Console.Error.WriteLine` is available here.
@@ -223,6 +223,85 @@ Executes an executable by the specified exePath.
+Asynchronously forwards StandardOutput and StandardError
+of the executable to the specified outputWriter and errorWriter using
+the intermediate char buffer with the specified bufferSize.
public static int Execute(string exePath, string arguments, TextWriter outputWriter, TextWriter errorWriter, string workingDirectory = "", int waitForExit = 2147483647, int bufferSize = 4096)
+ exePath stringThe path to the executable file to run.
+arguments stringCommand line arguments to pass into the executable.
+outputWriter TextWriterThe text writer to forward the standard output stream to.
+errorWriter TextWriterThe text writer to forward the standard error stream to.
+workingDirectory stringThe working directory to launch the executable in.
+waitForExit intA number of millisecoonds to wait for the process ending. +Use MaxValue to wait infinitely.
+bufferSize intThe sizes of the intermediate buffers to use for forwarding in number of char.
The exit code of the executable.
+Launch an executable and forward its output and error streams while it is running.
+var output = new StringWriter();
+var error = new StringWriter();
+
+var exitCode = ExeHelper.Execute("dotnet.exe", "--UNKNOWN", output, error, string.Empty, 5000, 2048);
+
+var o = output.ToString();
+var e = error.ToString();
+Launch an executable and forward its output and error streams to the Console of the main process.
+var exitCode = ExeHelper.Execute("dotnet.exe", "--UNKNOWN", Console.Out, Console.Error, string.Empty, 5000, 2048);
+
+
+
+ See the inner exception for more details.
+Executes an executable by the specified path. Does not extract output and error streams.
+Executes an executable by the specified exePath. Does not extract output and error streams.
exePath stringThe execute path.
+The path to the executable file to run.
arguments stringThe arguments.
+Command line arguments to pass into the executable.
workingDirectory stringThe working directory.
+The working directory to launch the executable in.
An executable's exit code.
+The exit code of the executable.
See the inner exception for details.
+See the inner exception for more details.