This class gives you access to many base functionalities of system platforms. Looks in sys
sub packages for more system APIs.
Static variables
staticargs:Void ‑> Array<String>
Available on Flash, HTML5
Returns all the arguments that were passed by the command line.
staticcommand:String ‑> Array<String> ‑> Int
Available on Flash, HTML5
Run the given command. 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).
Command arguments can be passed in two ways: 1. using args
, 2. appending to cmd
and leaving args
as null
.
-
When using
args
to pass command arguments, each argument will be automatically quoted, and shell meta-characters will be escaped if needed.cmd
should be an executable name that can be located in thePATH
environment variable, or a path to an executable. -
When
args
is not given or isnull
, command arguments can be appended tocmd
. No automatic quoting/escaping will be performed.cmd
should be formatted exactly as it would be when typed at the command line. It can run executables, as well as shell commands that are not executables (e.g. on Windows:dir
,cd
,echo
etc).
Read the sys.io.Process
api for a more complete way to start background processes.
Available on Flash, HTML5
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.
staticenvironment:Void ‑> Map<String, String>
Available on Flash, HTML5
Returns all environment variables.
staticexecutablePath:Void ‑> String
Available on Flash, HTML5
Returns the path to the current executable that we are running.
Available on Flash, HTML5
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.
Available on Flash, HTML5
Get the current working directory (usually the one in which the program was started)
staticprogramPath:Void ‑> String
Available on Flash, HTML5
Returns the absolute path to the current program file that we are running. Concretely, for an executable binary, it returns the path to the binary. For a script (e.g. a PHP file), it returns the path to the script.
staticputEnv:String ‑> String ‑> Void
Available on Flash, HTML5
Set the value of the given environment variable.
staticsetTimeLocale:String ‑> Bool
Available on Flash, HTML5
Change the current time locale, which will affect DateTools.format
date formating.
Returns true if the locale was successfully changed
Available on Flash, HTML5
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.
staticsystemName:Void ‑> String
Available on Flash, HTML5
Returns the name of the system you are running on. For instance : "Windows", "Linux", "BSD" and "Mac" depending on your desktop OS.
Static methods
Available on Neko, Android, iOS, macOS, Linux, Windows
Returns all the arguments that were passed by the command line.
staticcommand (cmd:String, ?args:Array<String>):Int
Available on Neko, macOS, Linux, Windows
Run the given command. 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).
Command arguments can be passed in two ways: 1. using args
, 2. appending to cmd
and leaving args
as null
.
-
When using
args
to pass command arguments, each argument will be automatically quoted, and shell meta-characters will be escaped if needed.cmd
should be an executable name that can be located in thePATH
environment variable, or a path to an executable. -
When
args
is not given or isnull
, command arguments can be appended tocmd
. No automatic quoting/escaping will be performed.cmd
should be formatted exactly as it would be when typed at the command line. It can run executables, as well as shell commands that are not executables (e.g. on Windows:dir
,cd
,echo
etc).
Read the sys.io.Process
api for a more complete way to start background processes.
staticenvironment ():Map<String, String>
Available on Neko, macOS, Linux, Windows
Returns all environment variables.
Available on Neko, Android, iOS, macOS, Linux, Windows
Exit the current process with the given error code.
Available on Neko, macOS, Linux, Windows
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.
Available on Neko, macOS, Linux, Windows
Get the current working directory (usually the one in which the program was started)
staticgetEnv (s:String):String
Available on Neko, macOS, Linux, Windows
Returns the value of the given environment variable.
staticprintln (v:Dynamic):Void
Available on Neko, Android, iOS, macOS, Linux, Windows
Print any value on the standard output, followed by a newline.
staticputEnv (s:String, v:String):Void
Available on Neko, macOS, Linux, Windows
Set the value of the given environment variable.
staticsleep (seconds:Float):Void
Available on Neko, Android, iOS, macOS, Linux, Windows
Suspend the current execution for the given time (in seconds).
Available on Neko, macOS, Linux, Windows
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.
staticsystemName ():String
Available on Neko, macOS, Linux, Windows
Returns the name of the system you are running on. For instance : "Windows", "Linux", "BSD" and "Mac" depending on your desktop OS.