mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
This commit merges EnvironmentVariables and CommandLineArguments into a single swift.Process global variable. POSIX-dependent parts are available as extension with "import POSIX". Original message: stdlib: split the Process class into a POSIX-dependent (EnvironmentVariables) and POSIX-independent (CommandLineArguments) parts Swift SVN r6331
18 lines
451 B
Swift
18 lines
451 B
Swift
struct _Process {
|
|
// This variable gets (re-)initialized on-demand to reflect the actual argument vector
|
|
var _arguments : String[]
|
|
|
|
var arguments : String[] {
|
|
// FIXME: this is not thread-safe. rdar://14193840
|
|
if _arguments.length == 0 {
|
|
_arguments = new String[Int(C_ARGC)]
|
|
for i in 0..Int(C_ARGC) {
|
|
_arguments[i] = String.fromCString(C_ARGV[i])
|
|
}
|
|
}
|
|
return _arguments
|
|
}
|
|
}
|
|
|
|
var Process : _Process
|