This module gives some APIs for operation system related actions.
This function changes the program current working directory.
import @os
os.chdir('/path/to/new/directory')
This function makes a directory.
os.mkdir('/path/to/new/directory')
This function returns CPU count.
println(os.cpu_count())
Will return the current directory that you are working in
println($curdir)
Will kill a process.
os.kill($process_id, $signal)
Will remove a directory.
os.rmdir("directory-name")
will return os name.
println($os.osname)
Will return does a directory exists or not.
os.isdir("dir-name")
Will return a file exists or not.
os.isfile("file-name")
Will return some file/dir exists or not.
os.exists("somethingfileordir")
This variable is a dictonary contains process environment variables.
For example:
import @os
println($os.env['TEST_VAR'])
Then we run this:
$ TEST_VAR=hello pashmak myfile.pashm
output:
hello
This function returns program current working directory.
println(os.cwd())