mirror of
https://github.com/twostraws/Brisk.git
synced 2026-10-16 01:49:09 +02:00
30 lines
558 B
Swift
30 lines
558 B
Swift
//
|
|
// Process.swift
|
|
// Terminal
|
|
//
|
|
// Created by Paul Hudson on 20/02/2020.
|
|
// Copyright © 2020 Hacking with Swift. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
func getpid() -> Int {
|
|
Int(ProcessInfo.processInfo.processIdentifier)
|
|
}
|
|
|
|
func getHostName() -> String {
|
|
ProcessInfo.processInfo.hostName
|
|
}
|
|
|
|
func getUserName() -> String {
|
|
ProcessInfo.processInfo.userName
|
|
}
|
|
|
|
func getenv(_ key: String) -> String {
|
|
ProcessInfo.processInfo.environment[key, default: ""]
|
|
}
|
|
|
|
func setenv(_ key: String, _ value: String) {
|
|
setenv(key, value, 1)
|
|
}
|