haXe API Documentation
Back | Index
class Sys
Available in neko, php, cpp
This class gives you access to many base functionalities of system platforms. Looks in sys sub packages for more system APIs.
static function args() : Array<String>
Returns all the arguments that were passed by the commandline.
static function command(cmd : String, ?args : Array<String>) : Int
Run the given command with the list of arguments. The command output will be printed on the same output as the current process. The current process will block until the command terminates and it will return the command result (0 if there was no error). Read the sys.io.Process api for a more complete way to start background processes.
static function cpuTime() : Float
Gives the most precise timestamp value (in seconds) but only account for the actual time spent running on the CPU for the current thread/process.
static function environment() : Hash<String>
Returns the whole environement variables.
static function executablePath() : String
Returns the path to the current executable that we are running.
static function exit(code : Int) : Void
Exit the current process with the given error code.
static function getChar(echo : Bool) : Int
Read a single input character from the standard input (without blocking) and returns it. Setting echo to true will also display it on the output.
static function getCwd() : String
Get the current working directory (usually the one in which the program was started)
static function getEnv(s : String) : String
Returns the value of the given environment variable.
static function print(v : Dynamic) : Void
Print any value on the standard output.
static function println(v : Dynamic) : Void
Print any value on the standard output, followed by a newline
static function putEnv(s : String, v : String) : Void
Set the value of the given environment variable.
static function setCwd(s : String) : Void
Change the current working directory.
static function setTimeLocale(loc : String) : Bool
Change the current time locale, which will affect DateTools.format date formating. Returns true if the locale was successfully changed
static function sleep(seconds : Float) : Void
Suspend the current execution for the given time (in seconds).
static function stderr() : haxe.io.Output
Returns the process standard error on which you can write.
static function stdin() : haxe.io.Input
Returns the process standard input, from which you can read what user enters. Usually it will block until the user send a full input line. See getChar for an alternative.
static function stdout() : haxe.io.Output
Returns the process standard output on which you can write.
static function systemName() : String
Returns the name of the system you are running on. For instance : "Windows", "Linux", "BSD" and "Mac" depending on your desktop OS.
static function time() : Float
Gives the most precise timestamp value (in seconds).
Back | Index