Adds devnull file handle

master
sloum 2 years ago
parent e48bce4b56
commit fc2fccc1f2

@ -538,7 +538,3 @@ func stringParensMatch(s string) bool {
return true
}
func GetFile(path string) *os.File {
devnull, _ := os.OpenFile(path, os.O_WRONLY, 0755)
return devnull
}

@ -29,7 +29,12 @@ var stdLibrary = vars{
"stdin": &IOHandle{os.Stdin, true, "file (read-only)"},
"stdout": &IOHandle{os.Stdout, true, "file (write-only)"},
"stderr": &IOHandle{os.Stderr, true, "file (write-only)"},
"devnull": &IOHandle{GetFile(os.DevNull), true, "file (write-only)"},
"devnull": func() *IOHandle {
devnull, _ := os.OpenFile(os.DevNull, os.O_WRONLY, 0755)
dn := &IOHandle{devnull, true, "file (write-only)"}
openFiles = append(openFiles, dn)
return dn
}(),
// TODO add env pathlookup
"PI": number(math.Pi),
"E": number(math.E),

Loading…
Cancel
Save