os: add os.stdout() and os.stderr(), returning os.File, similarly to os.stdin() (#9990)
parent
4ba11b7752
commit
0fa9a648ae
|
@ -146,6 +146,24 @@ pub fn stdin() File {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// stdout - return an os.File for stdout
|
||||||
|
pub fn stdout() File {
|
||||||
|
return File{
|
||||||
|
fd: 1
|
||||||
|
cfile: C.stdout
|
||||||
|
is_opened: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// stderr - return an os.File for stderr
|
||||||
|
pub fn stderr() File {
|
||||||
|
return File{
|
||||||
|
fd: 2
|
||||||
|
cfile: C.stderr
|
||||||
|
is_opened: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// **************************** Write ops ***************************
|
// **************************** Write ops ***************************
|
||||||
// write implements the Writer interface.
|
// write implements the Writer interface.
|
||||||
// It returns how many bytes were actually written.
|
// It returns how many bytes were actually written.
|
||||||
|
|
Loading…
Reference in New Issue