Created
November 27, 2022 01:01
-
-
Save jbadger3/a868264e7613fa8cedeec3ce2ed3dda8 to your computer and use it in GitHub Desktop.
Getting process information and file descriptors in Swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
let processInfo = ProcessInfo() | |
print("COMMAND: \(processInfo.processName)") | |
print("PID: \(processInfo.processIdentifier)") | |
print("USER \(processInfo.userName)") | |
print("stdin FD: \(FileHandle.standardInput.fileDescriptor)") | |
print("stdout FD: \(FileHandle.standardOutput.fileDescriptor)") | |
print("stderr FD: \(FileHandle.standardError.fileDescriptor)") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment