Documentation ¶
Overview ¶
Copyright (C) 2020-2022 Arm Limited or its affiliates and Contributors. All rights reserved.
SPDX-License-Identifier: Apache-2.0
Copyright (C) 2020-2022 Arm Limited or its affiliates and Contributors. All rights reserved.
SPDX-License-Identifier: Apache-2.0
Package subprocess allows you to spawn new processes, retrieve their output/error pipes, and obtain their return codes.
Copyright (C) 2020-2022 Arm Limited or its affiliates and Contributors. All rights reserved.
SPDX-License-Identifier: Apache-2.0
Copyright (C) 2020-2022 Arm Limited or its affiliates and Contributors. All rights reserved.
SPDX-License-Identifier: Apache-2.0
Copyright (C) 2020-2022 Arm Limited or its affiliates and Contributors. All rights reserved.
SPDX-License-Identifier: Apache-2.0
Index ¶
- func Execute(ctx context.Context, loggers logs.Loggers, messageOnStart string, ...) (err error)
- type Subprocess
- func (s *Subprocess) Cancel()
- func (s *Subprocess) Check() error
- func (s *Subprocess) Execute() (err error)
- func (s *Subprocess) IsOn() bool
- func (s *Subprocess) Restart() (err error)
- func (s *Subprocess) Setup(ctx context.Context, loggers logs.Loggers, messageOnStart string, ...) (err error)
- func (s *Subprocess) Start() (err error)
- func (s *Subprocess) Stop() (err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Subprocess ¶
type Subprocess struct {
// contains filtered or unexported fields
}
Subprocess describes what a subproccess is as well as any monitoring it may need.
func New ¶
func New(ctx context.Context, loggers logs.Loggers, messageOnStart string, messageOnSuccess, messageOnFailure string, cmd string, args ...string) (p *Subprocess, err error)
New creates a subprocess description.
func (*Subprocess) Cancel ¶
func (s *Subprocess) Cancel()
Cancel interrupts an on-going process. This method is idempotent.
func (*Subprocess) Check ¶
func (s *Subprocess) Check() error
Check checks whether the subprocess is correctly defined.
func (*Subprocess) Execute ¶
func (s *Subprocess) Execute() (err error)
Execute executes the command and waits for completion.
func (*Subprocess) IsOn ¶
func (s *Subprocess) IsOn() bool
IsOn states whether the subprocess is running or not.
func (*Subprocess) Restart ¶
func (s *Subprocess) Restart() (err error)
Restart restarts a process. It will stop the process if currently running.
func (*Subprocess) Setup ¶
func (s *Subprocess) Setup(ctx context.Context, loggers logs.Loggers, messageOnStart string, messageOnSuccess, messageOnFailure string, cmd string, args ...string) (err error)
Setup sets up a sub-process i.e. defines the command cmd and the messages on start, success and failure.
func (*Subprocess) Start ¶
func (s *Subprocess) Start() (err error)
Start starts the process if not already started. This method is idempotent.
func (*Subprocess) Stop ¶
func (s *Subprocess) Stop() (err error)
Stop stops the process straight away if currently working without waiting for completion. This method should be used in combination with `Start`. However, in order to interrupt a process however it was started (using `Start` or `Execute`), prefer `Cancel`. This method is idempotent.