Skip to content

Commit f55197f

Browse files
committed
add os.devnull
1 parent d5b4415 commit f55197f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

os/os.module.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,14 @@ func getdefpath() py.String {
5858
return py.String(":/bin:/usr/bin")
5959
}
6060

61+
// getdevnull returns the file path of the null device. This is '/dev/null' for posix and 'nul' for windows.
62+
func getdevnull() py.String {
63+
if runtime.GOOS == "windows" {
64+
return py.String("nul")
65+
}
66+
return py.String("/dev/null")
67+
}
68+
6169
func init() {
6270
methods := []*py.Method{
6371
py.MustNewMethod("getcwd", getCwd, 0, "Get the current working directory"),

0 commit comments

Comments
 (0)