5.9 KiB
5.9 KiB
Module - "os"
os := import("os")
Module Variables
o_rdonly
: equivalent of Go'sos.O_RDONLY
o_wronly
: equivalent of Go'sos.O_WRONLY
o_rdwr
: equivalent of Go'sos.O_RDWR
o_append
: equivalent of Go'sos.O_APPEND
o_create
: equivalent of Go'sos.O_CREATE
o_excl
: equivalent of Go'sos.O_EXCL
o_sync
: equivalent of Go'sos.O_SYNC
o_trunc
: equivalent of Go'sos.O_TRUNC
mode_dir
: equivalent of Go'sos.ModeDir
mode_append
: equivalent of Go'sos.ModeAppend
mode_exclusive
: equivalent of Go'sos.ModeExclusive
mode_temporary
: equivalent of Go'sos.ModeTemporary
mode_symlink
: equivalent of Go'sos.ModeSymlink
mode_device
: equivalent of Go'sos.ModeDevice
mode_named_pipe
: equivalent of Go'sos.ModeNamedPipe
mode_socket
: equivalent of Go'sos.ModeSocket
mode_setuid
: equivalent of Go'sos.ModeSetuid
mode_setgui
: equivalent of Go'sos.ModeSetgid
mode_char_device
: equivalent of Go'sos.ModeCharDevice
mode_sticky
: equivalent of Go'sos.ModeSticky
mode_irregular
: equivalent of Go'sos.ModeIrregular
mode_type
: equivalent of Go'sos.ModeType
mode_perm
: equivalent of Go'sos.ModePerm
seek_set
: equivalent of Go'sos.SEEK_SET
seek_cur
: equivalent of Go'sos.SEEK_CUR
seek_end
: equivalent of Go'sos.SEEK_END
path_separator
: equivalent of Go'sos.PathSeparator
path_list_separator
: equivalent of Go'sos.PathListSeparator
dev_null
: equivalent of Go'sos.DevNull
Module Functions
args() => array(string)
: returnsos.Args
chdir(dir string) => error
: port ofos.Chdir
functionchmod(name string, mode int) => error
: port of Go'sos.Chmod
functionchown(name string, uid int, gid int) => error
: port of Go'sos.Chown
functionclearenv()
: port of Go'sos.Clearenv
functionenviron() => array(string)
: port of Go'sos.Environ
functionexecutable() => string/error
: port of Go'sos.Executable()
functionexit(code int)
: port of Go'sos.Exit
functionexpand_env(s string) => string
: port of Go'sos.ExpandEnv
functiongetegid() => int
: port of Go'sos.Getegid
functiongetenv(s string) => string
: port of Go'sos.Getenv
functiongeteuid() => int
: port of Go'sos.Geteuid
functiongetgid() => int
: port of Go'sos.Getgid
functiongetgroups() => array(string)/error
: port of Go'sos.Getgroups
functiongetpagesize() => int
: port of Go'sos.Getpagesize
functiongetpid() => int
: port of Go'sos.Getpid
functiongetppid() => int
: port of Go'sos.Getppid
functiongetuid() => int
: port of Go'sos.Getuid
functiongetwd() => string/error
: port of Go'sos.Getwd
functionhostname() => string/error
: port of Go'sos.Hostname
functionlchown(name string, uid int, gid int) => error
: port of Go'sos.Lchown
functionlink(oldname string, newname string) => error
: port of Go'sos.Link
functionlookup_env(key string) => string/false
: port of Go'sos,LookupEnv
functionmkdir(name string, perm int) => error
: port of Go'sos.Mkdir
functionmkdir_all(name string, perm int) => error
: port of Go'sos.MkdirAll
functionreadlink(name string) => string/error
: port of Go'sos.Readlink
functionremove(name string) => error
: port of Go'sos.Remove
functionremove_all(name string) => error
: port of Go'sos.RemoveAll
functionrename(oldpath string, newpath string) => error
: port of Go'sos.Rename
functionsetenv(key string, value string) => error
: port of Go'sos.Setenv
functionsymlink(oldname string newname string) => error
: port of Go'sos.Symlink
functiontemp_dir() => string
: port of Go'sos.TempDir
functiontruncate(name string, size int) => error
: port of Go'sos.Truncate
functionunsetenv(key string) => error
: port of Go'sos.Unsetenv
functionuser_cache_dir() => string/error
: port of Go'sos.UserCacheDir
functioncreate(name string) => File/error
: port of Go'sos.Create
functionopen(name string) => File/error
: port of Go'sos.Open
functionopen_file(name string, flag int, perm int) => File/error
: port of Go'sos.OpenFile
functionfind_process(pid int) => Process/error
: port of Go'sos.FindProcess
functionstart_process(name string, argv array(string), dir string, env array(string)) => Process/error
: port of Go'sos.StartProcess
function
File Functions
file := os.create("myfile")
file.write_string("some data")
file.close()
chdir() => true/error
: port ofos.File.Chdir
functionchown(uid int, gid int) => true/error
: port ofos.File.Chown
functionclose() => error
: port ofos.File.Close
functionname() => string
: port ofos.File.Name
functionreaddirnames() => array(string)/error
: port ofos.File.Readdirnames
functionsync() => error
: port ofos.File.Sync
functionwrite(bytes) => int/error
: port ofos.File.Write
functionwrite_string(string) => int/error
: port ofos.File.WriteString
functionread(bytes) => int/error
: port ofos.File.Read
functionchmod(mode int) => error
: port ofos.File.Chmod
functionseek(offset int, whence int) => int/error
: port ofos.File.Seek
function
Process Functions
proc := start_process("app", ["arg1", "arg2"], "dir", [])
proc.wait()
kill() => error
: port ofos.Process.Kill
functionrelease() => error
: port ofos.Process.Release
functionsignal(signal int) => error
: port ofos.Process.Signal
functionwait() => ProcessState/error
: port ofos.Process.Wait
function
ProcessState Functions
proc := start_process("app", ["arg1", "arg2"], "dir", [])
stat := proc.wait()
pid := stat.pid()
exited() => bool
: port ofos.ProcessState.Exited
functionpid() => int
: port ofos.ProcessState.Pid
functionstring() => string
: port ofos.ProcessState.String
functionsuccess() => bool
: port ofos.ProcessState.Success
function