Class System
Object
Provides utility methods that interface with the operating environment.
- Source Code:
- View Source
Inner Classes
System .Process - Represents a program launched by
System.exec
.
Class Method Summary
workingDirectory ():File - Returns the current working directory.
temporaryDirectory ():File - Returns a path to a directory suitable for storing temporary files.
exit (status :
)Int - Causes the program to immediately stop running, returning the indicated exit code to the operating system.
crash ()- Causes the program to perform an illegal operation which forces an abnormal exit.
exec (path :
,String args :
):ListView<String> Maybe<Process> - Executes an external program with the given command line arguments.
Class Methods
@class
method workingDirectory
():File
Returns the current working directory. As relative file paths are evaluated relative to this directory, changing the current working directory will break path evaluation and Frost therfore does not provide a means to do so.
@class
method temporaryDirectory
():File
Returns a path to a directory suitable for storing temporary files. The operating environment may or may not automatically delete files written to this directory at some point after the program terminates. A well-behaved program will delete any temporary files it writes.
@class
method exit
(status :Int
)
Causes the program to immediately stop running, returning the indicated exit code to the operating system. Generally an exit value of 0 is taken to mean a normal exit and a non-zero value is taken to mean an error occurred, but the interpretation of the exit codeis system-dependent. Cleanup methods are not run when an exit is forced in this fashion; among other things, this means that open files will not be properly flushed and closed, which may cause output to be incomplete.
- Parameters:
-
- value of typestatus Int
@class
method crash
()
Causes the program to perform an illegal operation which forces an abnormal exit.
@class
method exec
(path :String
,
args :ListView<String>
):Maybe<Process>
Executes an external program with the given command line arguments. If path
is just a filename
(meaning it does not contain any path separator characters), the system PATH environment
variable will be searched to find it.
Returns the resulting process, or an error if it could not be created. Successfully creating the
process does not necessarily mean that the child program can actually be executed. If a
Process
is returned, but the child program cannot not be successfully started, the resulting
process will exit immediately with a nonzero exit code, but no error will otherwise be reported.
- Parameters:
-
- value of typepath String
- value of typeargs ListView<String>