Skip to content

Instantly share code, notes, and snippets.

View gatherheart's full-sized avatar
🤗
Always Gather Heart

Milkybean gatherheart

🤗
Always Gather Heart
View GitHub Profile
@gatherheart
gatherheart / runCommand.swift
Created April 1, 2023 16:17 — forked from dduan/runCommand.swift
How to fork()+execv() in Swift
import Foundation
func withCStrings(_ strings: [String], scoped: ([UnsafeMutablePointer<CChar>?]) throws -> Void) rethrows {
let cStrings = strings.map { strdup($0) }
try scoped(cStrings + [nil])
cStrings.forEach { free($0) }
}
enum RunCommandError: Error {
case WaitPIDError
@gatherheart
gatherheart / swift-frontend.txt
Created July 18, 2023 01:50 — forked from palaniraja/swift-frontend.txt
Swift frontend usage reference
OVERVIEW: Swift frontend
USAGE: swift-frontend -frontend
MODES:
-compile-module-from-interface
Treat the (single) input as a swiftinterface and produce a module
-dump-ast Parse and type-check input file(s) and dump AST(s)
-dump-interface-hash Parse input file(s) and dump interface token hash(es)
-dump-parse Parse input file(s) and dump AST(s)