process

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2015 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package process contains an implementation of a callback-based asynchronous process.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Async

type Async struct {
	// Command to run asynchronously
	Command *exec.Cmd

	// OnStart is called once the process has been started.
	OnStart func(p *os.Process)
	// OnExit will be called, if non-nil, once the process exits (with or without
	// an error).  OnExit is called after any call to either OnSuccess or OnError.
	OnExit func(state *os.ProcessState, err error)

	// OnSuccess will be called if it is non-nil and the process exits
	// successfully.
	OnSuccess func(state *os.ProcessState)
	// OnError will be called if it is non-nil and the process exits with an
	// error.
	OnError func(state *os.ProcessState, err error)
}

Async controls an asynchronous process with callbacks to handle its exit. Each callback can be nil to ignore that particular process state.

func (*Async) Start

func (a *Async) Start()

Start runs the specified command in the background and calls the provided handlers once the command exits.

Jump to

Keyboard shortcuts

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