SlideShare a Scribd company logo
Intro to CliWrap
Leveraging Command Line Tools from .NET Applications
@Tyrrrz | https://tyrrrz.me
What is CliWrap?
📦 https://github.com/Tyrrrz/CliWrap - ⭐ 1.4K - 📥 1M
Library for interacting with external command line interfaces. It provides a convenient model for
launching processes, redirecting input and output streams, awaiting completion, handling
cancellation, and more.
● Airtight abstraction over System.Diagnostics.Process
● Fluent configuration interface
● Flexible support for piping
● Fully asynchronous and cancellation-aware API
● Designed with strict immutability in mind
● Provides safety against typical deadlock scenarios
● Tested on Windows, Linux, and macOS
● Targets .NET Standard 2.0+, .NET Core 3.0+, .NET Framework 4.6.1+
● No external dependencies
Used by: Microsoft, StackOverflow, Pulumi, 500+ open source projects
CLI as the Perfect Library Format
Command Line Interface
Inputs Outputs
Command line arguments
Standard input stream
Environment variables
Exit code
Standard output stream
Standard error stream
✔ Any language
✔ Any operating system
✔ Consistent & simple protocol
> _
Pitfalls of System.Diagnostics.Process
⚠ Poorly designed API
- Process lifetime transitions are not represented by a state machine
- Some configuration properties conflict with each other
- Some process information is unavailable after exiting
- Some user-facing behavior is inconsistent between operating systems
- Async and cancellation support is lacking
⚠ Deadlock and race condition traps
- Buffer overflow in output or error stream may cause a deadlock
- Unterminated input stream may cause a deadlock
- Partially consumed input stream may cause a deadlock
- Reading output or error stream may race with process exiting
- Killing a process may race with its own graceful termination
⚠ Certain usage scenarios are impractical to implement
- Pull-based data streaming
- High-level piping targets
- Process-to-process piping
Execute await
CommandResult
Anatomy of CliWrap
Command
Configuration via fluent interface
CommandTask
- Command line arguments
- Environment variables
- Working directory
- Pipe configuration
...
- Process ID - Exit code
- Start time
- Exit time
Execute (buffered)
Listen (event stream)
Observe (event stream)
Pipes to in-memory buffers
Pipes to a bounded channel
Pipes to observer delegates
- Standard output
- Standard error
- ...
High-level execution models
BufferedCommandResult
IAsyncEnumerable<CommandEvent>
Command
IObservable<CommandEvent>
Coding time!
Thanks for joining!
Find me online:
@Tyrrrz | https://tyrrrz.me
Learn more about CliWrap:
https://github.com/Tyrrrz/CliWrap

More Related Content

What's hot

Open source operating systems
Open source operating systemsOpen source operating systems
Open source operating systems
Tushar B Kute
 
Security & Protection in Operating System
Security & Protection in Operating SystemSecurity & Protection in Operating System
Security & Protection in Operating System
Meghaj Mallick
 
System call
System callSystem call
System call
shahadat hossain
 
Zap vs burp
Zap vs burpZap vs burp
Zap vs burp
Tomasz Fajks
 
Appium & Robot Framework
Appium & Robot FrameworkAppium & Robot Framework
Appium & Robot Framework
Furkan Ertürk
 
Difference between Hardware, Software, Firmware, Middleware
Difference between Hardware, Software, Firmware, MiddlewareDifference between Hardware, Software, Firmware, Middleware
Difference between Hardware, Software, Firmware, Middleware
Tinzo02
 
Siber Olaylara Müdahale Sunumu
Siber Olaylara Müdahale SunumuSiber Olaylara Müdahale Sunumu
Siber Olaylara Müdahale Sunumu
BGA Cyber Security
 
Local Storage for Web Applications
Local Storage for Web ApplicationsLocal Storage for Web Applications
Local Storage for Web Applications
Markku Laine
 
Operating systems
Operating systemsOperating systems
Operating systems
7867867861
 
How to win big - Several Interesting Examples of Exploiting Financial & Gambl...
How to win big - Several Interesting Examples of Exploiting Financial & Gambl...How to win big - Several Interesting Examples of Exploiting Financial & Gambl...
How to win big - Several Interesting Examples of Exploiting Financial & Gambl...
Soroush Dalili
 
Siber Guvenlik ve Etik Hacking -1-
Siber Guvenlik ve Etik Hacking -1-Siber Guvenlik ve Etik Hacking -1-
Siber Guvenlik ve Etik Hacking -1-
Murat KARA
 
Installing Groovy engine in Apache Jmeter
Installing Groovy engine in Apache JmeterInstalling Groovy engine in Apache Jmeter
Installing Groovy engine in Apache Jmeter
NaveenKumar Namachivayam
 
bios booting process
bios booting processbios booting process
bios booting process
Taimoor Ashraf
 
Kesif ve Zafiyet Tarama
Kesif ve Zafiyet TaramaKesif ve Zafiyet Tarama
Kesif ve Zafiyet Tarama
Ferhat Ozgur Catak
 
Chpt7
Chpt7Chpt7
Thread
ThreadThread
Thread
sajidhuseyin
 
Difference between authentication and authorization in asp.net
Difference between authentication and authorization in asp.netDifference between authentication and authorization in asp.net
Difference between authentication and authorization in asp.net
Umar Ali
 
Her yönüyle linux sistem ve network güvenliği
Her yönüyle linux sistem ve network güvenliğiHer yönüyle linux sistem ve network güvenliği
Her yönüyle linux sistem ve network güvenliği
Ahmet Han
 
Siber Güvenlik ve Etik Hacking Sunu - 7
Siber Güvenlik ve Etik Hacking Sunu - 7Siber Güvenlik ve Etik Hacking Sunu - 7
Siber Güvenlik ve Etik Hacking Sunu - 7
Murat KARA
 

What's hot (20)

Open source operating systems
Open source operating systemsOpen source operating systems
Open source operating systems
 
Network Dersleri1
Network Dersleri1Network Dersleri1
Network Dersleri1
 
Security & Protection in Operating System
Security & Protection in Operating SystemSecurity & Protection in Operating System
Security & Protection in Operating System
 
System call
System callSystem call
System call
 
Zap vs burp
Zap vs burpZap vs burp
Zap vs burp
 
Appium & Robot Framework
Appium & Robot FrameworkAppium & Robot Framework
Appium & Robot Framework
 
Difference between Hardware, Software, Firmware, Middleware
Difference between Hardware, Software, Firmware, MiddlewareDifference between Hardware, Software, Firmware, Middleware
Difference between Hardware, Software, Firmware, Middleware
 
Siber Olaylara Müdahale Sunumu
Siber Olaylara Müdahale SunumuSiber Olaylara Müdahale Sunumu
Siber Olaylara Müdahale Sunumu
 
Local Storage for Web Applications
Local Storage for Web ApplicationsLocal Storage for Web Applications
Local Storage for Web Applications
 
Operating systems
Operating systemsOperating systems
Operating systems
 
How to win big - Several Interesting Examples of Exploiting Financial & Gambl...
How to win big - Several Interesting Examples of Exploiting Financial & Gambl...How to win big - Several Interesting Examples of Exploiting Financial & Gambl...
How to win big - Several Interesting Examples of Exploiting Financial & Gambl...
 
Siber Guvenlik ve Etik Hacking -1-
Siber Guvenlik ve Etik Hacking -1-Siber Guvenlik ve Etik Hacking -1-
Siber Guvenlik ve Etik Hacking -1-
 
Installing Groovy engine in Apache Jmeter
Installing Groovy engine in Apache JmeterInstalling Groovy engine in Apache Jmeter
Installing Groovy engine in Apache Jmeter
 
bios booting process
bios booting processbios booting process
bios booting process
 
Kesif ve Zafiyet Tarama
Kesif ve Zafiyet TaramaKesif ve Zafiyet Tarama
Kesif ve Zafiyet Tarama
 
Chpt7
Chpt7Chpt7
Chpt7
 
Thread
ThreadThread
Thread
 
Difference between authentication and authorization in asp.net
Difference between authentication and authorization in asp.netDifference between authentication and authorization in asp.net
Difference between authentication and authorization in asp.net
 
Her yönüyle linux sistem ve network güvenliği
Her yönüyle linux sistem ve network güvenliğiHer yönüyle linux sistem ve network güvenliği
Her yönüyle linux sistem ve network güvenliği
 
Siber Güvenlik ve Etik Hacking Sunu - 7
Siber Güvenlik ve Etik Hacking Sunu - 7Siber Güvenlik ve Etik Hacking Sunu - 7
Siber Güvenlik ve Etik Hacking Sunu - 7
 

Similar to Intro to CliWrap

Intro to CliWrap
Intro to CliWrapIntro to CliWrap
Intro to CliWrap
Oleksii Holub
 
Security defined routing_cybergamut_v1_1
Security defined routing_cybergamut_v1_1Security defined routing_cybergamut_v1_1
Security defined routing_cybergamut_v1_1
Joel W. King
 
Spark (Structured) Streaming vs. Kafka Streams - two stream processing platfo...
Spark (Structured) Streaming vs. Kafka Streams - two stream processing platfo...Spark (Structured) Streaming vs. Kafka Streams - two stream processing platfo...
Spark (Structured) Streaming vs. Kafka Streams - two stream processing platfo...
Guido Schmutz
 
Software defined network and Virtualization
Software defined network and VirtualizationSoftware defined network and Virtualization
Software defined network and Virtualization
idrajeev
 
Azure Event Hubs - Behind the Scenes With Kasun Indrasiri | Current 2022
Azure Event Hubs - Behind the Scenes With Kasun Indrasiri | Current 2022Azure Event Hubs - Behind the Scenes With Kasun Indrasiri | Current 2022
Azure Event Hubs - Behind the Scenes With Kasun Indrasiri | Current 2022
HostedbyConfluent
 
FlowER Erlang Openflow Controller
FlowER Erlang Openflow ControllerFlowER Erlang Openflow Controller
FlowER Erlang Openflow Controller
Holger Winkelmann
 
Fluentd at HKOScon
Fluentd at HKOSconFluentd at HKOScon
Fluentd at HKOScon
N Masahiro
 
Opmanager Workshop - Middle East
Opmanager Workshop - Middle EastOpmanager Workshop - Middle East
Opmanager Workshop - Middle East
ManageEngine, Zoho Corporation
 
CampusSDN2017 - Jawdat: SDN Technology Evolvement
CampusSDN2017 - Jawdat: SDN Technology EvolvementCampusSDN2017 - Jawdat: SDN Technology Evolvement
CampusSDN2017 - Jawdat: SDN Technology Evolvement
JawdatTI
 
Introduction to Apache Apex
Introduction to Apache ApexIntroduction to Apache Apex
Introduction to Apache Apex
Chinmay Kolhatkar
 
Performance analysis and troubleshooting using DTrace
Performance analysis and troubleshooting using DTracePerformance analysis and troubleshooting using DTrace
Performance analysis and troubleshooting using DTrace
Graeme Jenkinson
 
Hands on with CoAP and Californium
Hands on with CoAP and CaliforniumHands on with CoAP and Californium
Hands on with CoAP and Californium
Julien Vermillard
 
Apache Kafka
Apache KafkaApache Kafka
Apache Kafka
emreakis
 
Scorex, the Modular Blockchain Framework
Scorex, the Modular Blockchain FrameworkScorex, the Modular Blockchain Framework
Scorex, the Modular Blockchain Framework
Alex Chepurnoy
 
Copper: A high performance workflow engine
Copper: A high performance workflow engineCopper: A high performance workflow engine
Copper: A high performance workflow engine
dmoebius
 
Concurrency
ConcurrencyConcurrency
Concurrency
Biju Nair
 
Group meeting: TaintPipe - Pipelined Symbolic Taint Analysis
Group meeting: TaintPipe - Pipelined Symbolic Taint AnalysisGroup meeting: TaintPipe - Pipelined Symbolic Taint Analysis
Group meeting: TaintPipe - Pipelined Symbolic Taint Analysis
Yu-Hsin Hung
 
OpenFlow Tutorial
OpenFlow TutorialOpenFlow Tutorial
OpenFlow Tutorial
Ja-seop Kwak
 
Ratpack Web Framework
Ratpack Web FrameworkRatpack Web Framework
Ratpack Web Framework
Daniel Woods
 
Advanced WCF Workshop
Advanced WCF WorkshopAdvanced WCF Workshop
Advanced WCF Workshop
Ido Flatow
 

Similar to Intro to CliWrap (20)

Intro to CliWrap
Intro to CliWrapIntro to CliWrap
Intro to CliWrap
 
Security defined routing_cybergamut_v1_1
Security defined routing_cybergamut_v1_1Security defined routing_cybergamut_v1_1
Security defined routing_cybergamut_v1_1
 
Spark (Structured) Streaming vs. Kafka Streams - two stream processing platfo...
Spark (Structured) Streaming vs. Kafka Streams - two stream processing platfo...Spark (Structured) Streaming vs. Kafka Streams - two stream processing platfo...
Spark (Structured) Streaming vs. Kafka Streams - two stream processing platfo...
 
Software defined network and Virtualization
Software defined network and VirtualizationSoftware defined network and Virtualization
Software defined network and Virtualization
 
Azure Event Hubs - Behind the Scenes With Kasun Indrasiri | Current 2022
Azure Event Hubs - Behind the Scenes With Kasun Indrasiri | Current 2022Azure Event Hubs - Behind the Scenes With Kasun Indrasiri | Current 2022
Azure Event Hubs - Behind the Scenes With Kasun Indrasiri | Current 2022
 
FlowER Erlang Openflow Controller
FlowER Erlang Openflow ControllerFlowER Erlang Openflow Controller
FlowER Erlang Openflow Controller
 
Fluentd at HKOScon
Fluentd at HKOSconFluentd at HKOScon
Fluentd at HKOScon
 
Opmanager Workshop - Middle East
Opmanager Workshop - Middle EastOpmanager Workshop - Middle East
Opmanager Workshop - Middle East
 
CampusSDN2017 - Jawdat: SDN Technology Evolvement
CampusSDN2017 - Jawdat: SDN Technology EvolvementCampusSDN2017 - Jawdat: SDN Technology Evolvement
CampusSDN2017 - Jawdat: SDN Technology Evolvement
 
Introduction to Apache Apex
Introduction to Apache ApexIntroduction to Apache Apex
Introduction to Apache Apex
 
Performance analysis and troubleshooting using DTrace
Performance analysis and troubleshooting using DTracePerformance analysis and troubleshooting using DTrace
Performance analysis and troubleshooting using DTrace
 
Hands on with CoAP and Californium
Hands on with CoAP and CaliforniumHands on with CoAP and Californium
Hands on with CoAP and Californium
 
Apache Kafka
Apache KafkaApache Kafka
Apache Kafka
 
Scorex, the Modular Blockchain Framework
Scorex, the Modular Blockchain FrameworkScorex, the Modular Blockchain Framework
Scorex, the Modular Blockchain Framework
 
Copper: A high performance workflow engine
Copper: A high performance workflow engineCopper: A high performance workflow engine
Copper: A high performance workflow engine
 
Concurrency
ConcurrencyConcurrency
Concurrency
 
Group meeting: TaintPipe - Pipelined Symbolic Taint Analysis
Group meeting: TaintPipe - Pipelined Symbolic Taint AnalysisGroup meeting: TaintPipe - Pipelined Symbolic Taint Analysis
Group meeting: TaintPipe - Pipelined Symbolic Taint Analysis
 
OpenFlow Tutorial
OpenFlow TutorialOpenFlow Tutorial
OpenFlow Tutorial
 
Ratpack Web Framework
Ratpack Web FrameworkRatpack Web Framework
Ratpack Web Framework
 
Advanced WCF Workshop
Advanced WCF WorkshopAdvanced WCF Workshop
Advanced WCF Workshop
 

More from Oleksii Holub

Reality-Driven Testing using TestContainers
Reality-Driven Testing using TestContainersReality-Driven Testing using TestContainers
Reality-Driven Testing using TestContainers
Oleksii Holub
 
Expression trees in C#
Expression trees in C#Expression trees in C#
Expression trees in C#
Oleksii Holub
 
Fallacies of unit testing
Fallacies of unit testingFallacies of unit testing
Fallacies of unit testing
Oleksii Holub
 
Expression trees in c#
Expression trees in c#Expression trees in c#
Expression trees in c#
Oleksii Holub
 
GitHub Actions in action
GitHub Actions in actionGitHub Actions in action
GitHub Actions in action
Oleksii Holub
 
Alexey Golub - Writing parsers in c# | 3Shape Meetup
Alexey Golub - Writing parsers in c# | 3Shape MeetupAlexey Golub - Writing parsers in c# | 3Shape Meetup
Alexey Golub - Writing parsers in c# | 3Shape Meetup
Oleksii Holub
 
Alexey Golub - Dependency absolution (application as a pipeline) | Svitla Sma...
Alexey Golub - Dependency absolution (application as a pipeline) | Svitla Sma...Alexey Golub - Dependency absolution (application as a pipeline) | Svitla Sma...
Alexey Golub - Dependency absolution (application as a pipeline) | Svitla Sma...
Oleksii Holub
 

More from Oleksii Holub (7)

Reality-Driven Testing using TestContainers
Reality-Driven Testing using TestContainersReality-Driven Testing using TestContainers
Reality-Driven Testing using TestContainers
 
Expression trees in C#
Expression trees in C#Expression trees in C#
Expression trees in C#
 
Fallacies of unit testing
Fallacies of unit testingFallacies of unit testing
Fallacies of unit testing
 
Expression trees in c#
Expression trees in c#Expression trees in c#
Expression trees in c#
 
GitHub Actions in action
GitHub Actions in actionGitHub Actions in action
GitHub Actions in action
 
Alexey Golub - Writing parsers in c# | 3Shape Meetup
Alexey Golub - Writing parsers in c# | 3Shape MeetupAlexey Golub - Writing parsers in c# | 3Shape Meetup
Alexey Golub - Writing parsers in c# | 3Shape Meetup
 
Alexey Golub - Dependency absolution (application as a pipeline) | Svitla Sma...
Alexey Golub - Dependency absolution (application as a pipeline) | Svitla Sma...Alexey Golub - Dependency absolution (application as a pipeline) | Svitla Sma...
Alexey Golub - Dependency absolution (application as a pipeline) | Svitla Sma...
 

Recently uploaded

How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
danishmna97
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
DianaGray10
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
Zilliz
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Malak Abu Hammad
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
kumardaparthi1024
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Speck&Tech
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
shyamraj55
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
Mariano Tinti
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
Edge AI and Vision Alliance
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
Zilliz
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
panagenda
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems S.M.S.A.
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 

Recently uploaded (20)

How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 

Intro to CliWrap

  • 1. Intro to CliWrap Leveraging Command Line Tools from .NET Applications @Tyrrrz | https://tyrrrz.me
  • 2. What is CliWrap? 📦 https://github.com/Tyrrrz/CliWrap - ⭐ 1.4K - 📥 1M Library for interacting with external command line interfaces. It provides a convenient model for launching processes, redirecting input and output streams, awaiting completion, handling cancellation, and more. ● Airtight abstraction over System.Diagnostics.Process ● Fluent configuration interface ● Flexible support for piping ● Fully asynchronous and cancellation-aware API ● Designed with strict immutability in mind ● Provides safety against typical deadlock scenarios ● Tested on Windows, Linux, and macOS ● Targets .NET Standard 2.0+, .NET Core 3.0+, .NET Framework 4.6.1+ ● No external dependencies Used by: Microsoft, StackOverflow, Pulumi, 500+ open source projects
  • 3. CLI as the Perfect Library Format Command Line Interface Inputs Outputs Command line arguments Standard input stream Environment variables Exit code Standard output stream Standard error stream ✔ Any language ✔ Any operating system ✔ Consistent & simple protocol > _
  • 4. Pitfalls of System.Diagnostics.Process ⚠ Poorly designed API - Process lifetime transitions are not represented by a state machine - Some configuration properties conflict with each other - Some process information is unavailable after exiting - Some user-facing behavior is inconsistent between operating systems - Async and cancellation support is lacking ⚠ Deadlock and race condition traps - Buffer overflow in output or error stream may cause a deadlock - Unterminated input stream may cause a deadlock - Partially consumed input stream may cause a deadlock - Reading output or error stream may race with process exiting - Killing a process may race with its own graceful termination ⚠ Certain usage scenarios are impractical to implement - Pull-based data streaming - High-level piping targets - Process-to-process piping
  • 5. Execute await CommandResult Anatomy of CliWrap Command Configuration via fluent interface CommandTask - Command line arguments - Environment variables - Working directory - Pipe configuration ... - Process ID - Exit code - Start time - Exit time
  • 6. Execute (buffered) Listen (event stream) Observe (event stream) Pipes to in-memory buffers Pipes to a bounded channel Pipes to observer delegates - Standard output - Standard error - ... High-level execution models BufferedCommandResult IAsyncEnumerable<CommandEvent> Command IObservable<CommandEvent>
  • 8. Thanks for joining! Find me online: @Tyrrrz | https://tyrrrz.me Learn more about CliWrap: https://github.com/Tyrrrz/CliWrap