UPdate.
This commit is contained in:
Vendored
+36
@@ -0,0 +1,36 @@
|
||||
// retoor <retoor@molodetz.nl>
|
||||
|
||||
import "os" for Platform, Process
|
||||
|
||||
System.print("=== OS Module Demo ===\n")
|
||||
|
||||
System.print("--- Platform Information ---")
|
||||
System.print("Name: %(Platform.name)")
|
||||
System.print("Is POSIX: %(Platform.isPosix)")
|
||||
System.print("Is Windows: %(Platform.isWindows)")
|
||||
System.print("Home Path: %(Platform.homePath)")
|
||||
|
||||
System.print("\n--- Process Information ---")
|
||||
System.print("PID: %(Process.pid)")
|
||||
System.print("Parent PID: %(Process.ppid)")
|
||||
System.print("Working Directory: %(Process.cwd)")
|
||||
System.print("Wren Version: %(Process.version)")
|
||||
|
||||
System.print("\n--- Command Line Arguments ---")
|
||||
System.print("Arguments: %(Process.arguments)")
|
||||
System.print("All Arguments: %(Process.allArguments)")
|
||||
|
||||
System.print("\n--- Platform-Specific Paths ---")
|
||||
var separator = Platform.isWindows ? "\\" : "/"
|
||||
var configPath = Platform.homePath + separator + ".config"
|
||||
System.print("Config directory: %(configPath)")
|
||||
|
||||
System.print("\n--- Conditional Exit ---")
|
||||
var args = Process.arguments
|
||||
if (args.count > 0 && args[0] == "--fail") {
|
||||
System.print("Exiting with error code 1")
|
||||
Process.exit(1)
|
||||
}
|
||||
|
||||
System.print("Exiting normally")
|
||||
Process.exit(0)
|
||||
Reference in New Issue
Block a user