os

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2023 License: UPL-1.0 Imports: 7 Imported by: 1

Documentation

Overview

Copyright (c) 2021, 2022, Oracle and/or its affiliates. Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateTempFile added in v1.3.0

func CreateTempFile(filenamePattern string, data []byte) (*os.File, error)

CreateTempFile creates a temp file from a filename pattern and data

func FileExists added in v1.4.0

func FileExists(filePath string) (bool, error)

FileExists returns true if the file at the specified path exists, false otherwise

func RemoveTempFiles

func RemoveTempFiles(log *zap.SugaredLogger, regexPattern string) error

func RunBash

func RunBash(inArgs ...string) (string, string, error)

RunBash runs a bash script

Types

type CmdRunner

type CmdRunner interface {
	Run(cmd *exec.Cmd) (stdout []byte, stderr []byte, err error)
}

CmdRunner defines the interface to run an external command

type DefaultRunner

type DefaultRunner struct {
}

DefaultRunner is used to run an external command

func (DefaultRunner) Run

func (r DefaultRunner) Run(cmd *exec.Cmd) (stdout []byte, stderr []byte, err error)

Run runs an external command. The caller is expected to initialize the cmd name and args, for example using exec.Command(...)

type GenericTestRunner added in v1.4.0

type GenericTestRunner struct {
	StdOut []byte
	StdErr []byte
	Err    error
}

GenericTestRunner is used to run generic OS commands with expected results

func (GenericTestRunner) Run added in v1.4.0

func (r GenericTestRunner) Run(_ *exec.Cmd) (stdout []byte, stderr []byte, err error)

Run GenericTestRunner executor

Jump to

Keyboard shortcuts

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