Skip to content

Instantly share code, notes, and snippets.

@jbadger3
jbadger3 / countdown.swift
Created November 29, 2022 21:56
A swift script used to demonstrate stream buffering and flushing
#!/usr/bin/swift
import Foundation
let arguments = CommandLine.arguments
let startingValue = Int(arguments[1])!
var flush = false
if arguments.count == 3 {
@jbadger3
jbadger3 / PipeExample.swift
Created November 29, 2022 22:54
Example of piping together commands in swift.
#!/usr/bin/swift
import Foundation
let catProcess = Process()
catProcess.executableURL = URL(fileURLWithPath: "/bin/cat")
catProcess.arguments = ["PipeExample.swift"]
let pipe1 = Pipe()
let grepProcess = Process()