Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

⚙️ sys - Sistem İşlemleri

Process, Environment, Command Line, Platform

62
Fonksiyon
801
Satır
25 KB
Boyut

🚀 Hızlı Başlangıç

içe_aktar sys

// Command line arguments
değişken args = sys.args()
yazdır("Program: " + args[0])

// Environment variables
değişken path = sys.env("PATH")
sys.set_env("MY_VAR", "value")

// Process execution
değişken sonuç = sys.exec("ls", ["-la"])
yazdır("Çıktı: " + sonuç.stdout)
yazdır("Exit code: " + sonuç.exit_code.yazıya())

// Platform info
yazdır("OS: " + sys.os())  // "linux", "windows", "macos"
yazdır("Arch: " + sys.arch())  // "x86_64", "aarch64"

📚 Özellikler

  • Process management (spawn, exec, kill)
  • Environment variables
  • Command line arguments
  • Exit codes
  • Platform detection

💡 Örnekler

Build Script

içe_aktar sys, fs

fonksiyon build() -> Sonuç yap
    yazdır("Building project...")
    
    // Clean
    eğer fs.var_mı("build") ise yap
        fs.dizin_sil_recursive("build")
    son
    fs.dizin_oluştur("build")
    
    // Compile
    değişken sonuç = sys.exec("rustc", ["--crate-type", "lib", "src/lib.rs", "-o", "build/libmy.so"])
    
    eğer sonuç.exit_code != 0 ise yap
        yazdır("Build failed:")
        yazdır(sonuç.stderr)
        dön Hata("Compilation error")
    son
    
    yazdır("Build successful!")
    dön Tamam(yok)
son

build()

← thread | terminal →