executor

package
v0.0.0-...-6700e38 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 24, 2025 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Overview

Copyright 2023 The Chromium Authors Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MultipleCommandsExecutor

type MultipleCommandsExecutor struct {
	// contains filtered or unexported fields
}

MultipleCommandsExecutor a executor for executing multiple commands.

Support to execute multiple command like this `ls -a | grep -o | sort -r` This requires `bash` support like this `exec.Command("bash", "-c", "ls -a | grep -o | sort -r")`

This `struct` is created by combining multiple commands by `io.Pipe`. The concept is to pipe the previous command to next command.

func New

func New(cmds ...*exec.Cmd) *MultipleCommandsExecutor

New the function used for creating an `MultipleCommandsExecutor`

For example: `ls -a | grep -o | sort -r` multipleCmdsExecutor := New(

exec.Command("ls", "-a"),
exec.Command("grep", "-o"),
exec.Command("sort", "-r"),

)

func (*MultipleCommandsExecutor) Exec

Exec start executing the commands and waiting for the result. We will close all the `io.PipeWriter` after finished.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL