MCPcopy Create free account
hub / github.com/cogentcore/core / SetToOS

Method SetToOS

base/exec/stdio.go:56–63  ·  view source on GitHub ↗

SetToOS sets the current IO to os.Std*, returning a StdIO with the current IO settings prior to this call, which can be used to restore. Note: os.Std* are *os.File types, and this function will panic if the current IO are not actually *os.Files. The results of a prior SetToOS call will do the right

()

Source from the content-addressed store, hash-verified

54// The results of a prior SetToOS call will do the right thing for
55// saving and restoring the os state.
56func (st *StdIO) SetToOS() *StdIO {
57 cur := &StdIO{}
58 cur.SetFromOS()
59 os.Stdout = st.Out.(*os.File)
60 os.Stderr = st.Err.(*os.File)
61 os.Stdin = st.In.(*os.File)
62 return cur
63}
64
65// Print prints to the [StdIO.Out]
66func (st *StdIO) Print(v ...any) {

Callers 2

RunBuiltinOrCommandMethod · 0.80
RestoreOrigStdIOMethod · 0.80

Calls 1

SetFromOSMethod · 0.95

Tested by

no test coverage detected