ctxstdio

package module
v0.0.0-...-306c830 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2026 License: MIT Imports: 3 Imported by: 1 module, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

ctxstdio

ctxstdio allows accessing stdio streams in Golang via a common context interface. By default the os streams are returned, but they can be overridden on a context by calling the ctxstdio.Set function.

The intended use is for providing overrideable stdio streams to application wide contexts - e.g. a context which is cancelled by the signal handler is a good target.

Installation

go get -u github.com/wrouesnel/ctxstdio

Documentation

Overview

Package ctxstdio provides overrideable access to stdio streams from a context.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Set

func Set(ctx context.Context, stdOut io.Writer, stdErr io.Writer, stdIn io.ReadCloser) context.Context

Set alternate stdio streams

func StdErr

func StdErr(ctx context.Context) io.Writer

StdErr gets the stored stdin stream from the context

func StdOut

func StdOut(ctx context.Context) io.Writer

StdOut gets the stored stdin stream from the context

func Stdin

func Stdin(ctx context.Context) io.ReadCloser

Stdin gets the stored stdinsstream from the context

Types

This section is empty.

Jump to

Keyboard shortcuts

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