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
()
| 54 | // The results of a prior SetToOS call will do the right thing for |
| 55 | // saving and restoring the os state. |
| 56 | func (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] |
| 66 | func (st *StdIO) Print(v ...any) { |
no test coverage detected