CmdOneLiner.NET 2.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package CmdOneLiner.NET --version 2.0.0                
NuGet\Install-Package CmdOneLiner.NET -Version 2.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CmdOneLiner.NET" Version="2.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CmdOneLiner.NET --version 2.0.0                
#r "nuget: CmdOneLiner.NET, 2.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install CmdOneLiner.NET as a Cake Addin
#addin nuget:?package=CmdOneLiner.NET&version=2.0.0

// Install CmdOneLiner.NET as a Cake Tool
#tool nuget:?package=CmdOneLiner.NET&version=2.0.0                

CmdOneLiner.NET

CmdOneLiner.NET easily executes command-line applications from .NET in a single line of code.

NuGet version (CmdOneLiner.NET)

Usage

Basic usage

CmdResult cmdOut = CmdOneLiner.Run("Sleeper 5", timeout: TimeSpan.FromSeconds(20));
Console.WriteLine($"Sleeper program executed in {cmdOut?.RunningFor.TotalSeconds} seconds ({cmdOut?.TotalProcessorTime?.TotalSeconds}), used {cmdOut?.MaxRamUsedBytes / 1024 / 1024} MiB of RAM, and printed to the standard output: \"{cmdOut?.StdOut}\".");

Background process + callbacks

CmdOneLiner.RunInBackground("Sleeper 5", (cmdOut) => { Console.WriteLine($"Sleeper program executed in the background in {cmdOut.RunningFor.TotalSeconds} seconds."); });

Background process + callbacks

CmdResult cmdOut = await CmdOneLiner.RunAsync("Sleeper 5");
Console.WriteLine($"Sleeper program executed asynchronously in {cmdOut.RunningFor.TotalSeconds} seconds");

Features

  • Extremely easy to use.
  • Multiplatform (platform agnostic).
  • Measures maximum RAM usage and CPU time.
  • Optional command execution timeout.
  • Optional token allows cancellation from another thread.
  • Can be run synchronously, asynchronously, or with a callback.
Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net5.0

    • No dependencies.
  • net6.0

    • No dependencies.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on CmdOneLiner.NET:

Package Downloads
Sys.IO.NG

Adds timeout, asynchronous cancellation, and Disk I/O (not CPU) Prioritization to File and Directory read/write operations on Linux. On Windows, it transparently performs File/Directory operations ignoring timeouts/cancellation/priorities (same as System.IO). It also solves Directory.Move() not working on Linux when source and destination are on different drives/mountpoints.

SchrodingersStorage

An simple object-oriented file system abstraction where files and directories can be stored in one directory, two, both, or none. This is useful for accessing data while it is being transfererred between drives.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.2.0 584 11/22/2024
2.1.0 804 1/31/2023
2.0.0 293 1/21/2023
1.0.4 302 1/7/2023
1.0.3 813 1/7/2023
1.0.2 481 5/30/2021
1.0.1 304 5/21/2021
1.0.0 382 5/21/2021