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 to wait infinitely. return: type: Heleonix.Execution.ExeResult @@ -115,32 +114,111 @@ items: assemblies: - Heleonix.Execution namespace: Heleonix.Execution - summary: Executes an executable by the specified path. Does not extract output and error streams. + summary: Executes an executable by the specified 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 and + + of the executable to the specified 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 of the main process. + +
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 to wait infinitely. + - id: bufferSize + type: System.Int32 + description: The sizes of the intermediate buffers to use for forwarding in number of 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 @@

Parameters

exePath string
-

Defines the path to executable.

+

The path to the executable file to run.

arguments string
-

Represents the command line arguments.

+

Command line arguments to pass into the executable.

extractOutput bool

Defines whether to redirect and extract standard output and errors or not.

workingDirectory string
-

The current working directory. -Relative paths inside the executable will be relative to this working directory.

+

The working directory to launch the executable in.

waitForExit int
-

A number of millisecoonds to wait for process ending. +

A number of millisecoonds to wait for the process ending. Use MaxValue to wait infinitely.

@@ -202,15 +201,16 @@

Returns

Examples

-

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 @@

Exceptions

+ + +

+ Execute(string, string, TextWriter, TextWriter, string, int, int) + +

+ +

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)
+
+ +

Parameters

+
+
exePath string
+

The path to the executable file to run.

+
+
arguments string
+

Command line arguments to pass into the executable.

+
+
outputWriter TextWriter
+

The text writer to forward the standard output stream to.

+
+
errorWriter TextWriter
+

The text writer to forward the standard error stream to.

+
+
workingDirectory string
+

The working directory to launch the executable in.

+
+
waitForExit int
+

A number of millisecoonds to wait for the process ending. +Use MaxValue to wait infinitely.

+
+
bufferSize int
+

The sizes of the intermediate buffers to use for forwarding in number of char.

+
+
+ +

Returns

+
+
int
+

The exit code of the executable.

+
+
+ + + + + + +

Examples

+

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);
+ + + +

Exceptions

+
+
InvalidOperationException
+

See the inner exception for more details.

+
+
+ + +

@@ -230,7 +309,7 @@

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.

@@ -241,20 +320,20 @@

Parameters

exePath string
-

The execute path.

+

The path to the executable file to run.

arguments string
-

The arguments.

+

Command line arguments to pass into the executable.

workingDirectory string
-

The working directory.

+

The working directory to launch the executable in.

Returns

int
-

An executable's exit code.

+

The exit code of the executable.

@@ -268,7 +347,7 @@

Returns

Exceptions

InvalidOperationException
-

See the inner exception for details.

+

See the inner exception for more details.

diff --git a/docs/Heleonix.Execution/index.html b/docs/Heleonix.Execution/index.html index ba39811..df06deb 100644 --- a/docs/Heleonix.Execution/index.html +++ b/docs/Heleonix.Execution/index.html @@ -16,7 +16,7 @@ - + diff --git a/docs/index.json b/docs/index.json index b4e603a..660cdb4 100644 --- a/docs/index.json +++ b/docs/index.json @@ -167,7 +167,7 @@ "Heleonix.Execution/Heleonix.Execution.ExeHelper.html": { "href": "Heleonix.Execution/Heleonix.Execution.ExeHelper.html", "title": "Class ExeHelper | Heleonix", - "keywords": "Class ExeHelper Namespace Heleonix.Execution Assembly Heleonix.Execution.dll Provides functionality for working with executables. public static class ExeHelper Inheritance object ExeHelper Inherited Members object.GetType() object.MemberwiseClone() object.ToString() object.Equals(object) object.Equals(object, object) object.ReferenceEquals(object, object) object.GetHashCode() Methods Execute(string, string, bool, string, int) Executes an executable by the specified exePath. public static ExeResult Execute(string exePath, string arguments, bool extractOutput, string workingDirectory = \"\", int waitForExit = 2147483647) Parameters exePath string Defines the path to executable. arguments string Represents the command line arguments. extractOutput bool Defines whether to redirect and extract standard output and errors or not. workingDirectory string The current working directory. Relative paths inside the executable will be relative to this working directory. waitForExit int A number of millisecoonds to wait for process ending. Use MaxValue to wait infinitely. Returns ExeResult An exit result. Examples 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. Exceptions InvalidOperationException See the inner exception for details. Execute(string, string, string) Executes an executable by the specified path. Does not extract output and error streams. public static int Execute(string exePath, string arguments, string workingDirectory = \"\") Parameters exePath string The execute path. arguments string The arguments. workingDirectory string The working directory. Returns int An executable's exit code. Exceptions InvalidOperationException See the inner exception for details." + "keywords": "Class ExeHelper Namespace Heleonix.Execution Assembly Heleonix.Execution.dll Provides functionality for working with executables. public static class ExeHelper Inheritance object ExeHelper Inherited Members object.GetType() object.MemberwiseClone() object.ToString() object.Equals(object) object.Equals(object, object) object.ReferenceEquals(object, object) object.GetHashCode() Methods Execute(string, string, bool, string, int) Executes an executable by the specified exePath. public static ExeResult Execute(string exePath, string arguments, bool extractOutput, string workingDirectory = \"\", int waitForExit = 2147483647) Parameters exePath string The path to the executable file to run. arguments string Command line arguments to pass into the executable. extractOutput bool Defines whether to redirect and extract standard output and errors or not. workingDirectory string The working directory to launch the executable in. waitForExit int A number of millisecoonds to wait for the process ending. Use MaxValue to wait infinitely. Returns ExeResult An exit result. Examples 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. Exceptions InvalidOperationException See the inner exception for details. Execute(string, string, TextWriter, TextWriter, string, int, int) 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) Parameters exePath string The path to the executable file to run. arguments string Command line arguments to pass into the executable. outputWriter TextWriter The text writer to forward the standard output stream to. errorWriter TextWriter The text writer to forward the standard error stream to. workingDirectory string The working directory to launch the executable in. waitForExit int A number of millisecoonds to wait for the process ending. Use MaxValue to wait infinitely. bufferSize int The sizes of the intermediate buffers to use for forwarding in number of char. Returns int The exit code of the executable. Examples 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); Exceptions InvalidOperationException See the inner exception for more details. Execute(string, string, string) Executes an executable by the specified exePath. Does not extract output and error streams. public static int Execute(string exePath, string arguments, string workingDirectory = \"\") Parameters exePath string The path to the executable file to run. arguments string Command line arguments to pass into the executable. workingDirectory string The working directory to launch the executable in. Returns int The exit code of the executable. Exceptions InvalidOperationException See the inner exception for more details." }, "Heleonix.Execution/Heleonix.Execution.ExeResult.html": { "href": "Heleonix.Execution/Heleonix.Execution.ExeResult.html", diff --git a/docs/manifest.json b/docs/manifest.json index 8ea1027..19f6043 100644 --- a/docs/manifest.json +++ b/docs/manifest.json @@ -1,5 +1,5 @@ { - "source_base_path": "D:/a/Heleonix.Docfx.Plugins.XmlDoc/Heleonix.Docfx.Plugins.XmlDoc/Hx_Artifacts/DocFX", + "source_base_path": "D:/Dev/Projects/Heleonix/docs", "xrefmap": "xrefmap.yml", "files": [ { diff --git a/docs/xrefmap.yml b/docs/xrefmap.yml index cf9f066..6b73b15 100644 --- a/docs/xrefmap.yml +++ b/docs/xrefmap.yml @@ -218,6 +218,15 @@ references: fullName.vb: Heleonix.Execution.ExeHelper.Execute(String, String, Boolean, String, Integer) nameWithType: ExeHelper.Execute(string, string, bool, string, int) nameWithType.vb: ExeHelper.Execute(String, String, Boolean, String, Integer) +- uid: Heleonix.Execution.ExeHelper.Execute(System.String,System.String,System.IO.TextWriter,System.IO.TextWriter,System.String,System.Int32,System.Int32) + name: Execute(string, string, TextWriter, TextWriter, string, int, int) + href: Heleonix.Execution/Heleonix.Execution.ExeHelper.html#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) + name.vb: Execute(String, String, TextWriter, TextWriter, String, Integer, Integer) + fullName: Heleonix.Execution.ExeHelper.Execute(string, string, System.IO.TextWriter, System.IO.TextWriter, string, int, int) + fullName.vb: Heleonix.Execution.ExeHelper.Execute(String, String, System.IO.TextWriter, System.IO.TextWriter, String, Integer, Integer) + nameWithType: ExeHelper.Execute(string, string, TextWriter, TextWriter, string, int, int) + nameWithType.vb: ExeHelper.Execute(String, String, TextWriter, TextWriter, String, Integer, Integer) - uid: Heleonix.Execution.ExeHelper.Execute(System.String,System.String,System.String) name: Execute(string, string, string) href: Heleonix.Execution/Heleonix.Execution.ExeHelper.html#Heleonix_Execution_ExeHelper_Execute_System_String_System_String_System_String_