Skip to content

Commit

Permalink
locheck: add support for linux.
Browse files Browse the repository at this point in the history
  • Loading branch information
AnessZurba committed May 2, 2024
1 parent 327454d commit 81343ed
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ VERSION = 0.9.11

PREFIX = /usr/local
INSTALL_PATH = $(PREFIX)/bin/$(EXECUTABLE_NAME)
BUILD_PATH = .build/apple/Products/Release/$(EXECUTABLE_NAME)
BUILD_PATH = .build/release/$(EXECUTABLE_NAME)
CURRENT_PATH = $(PWD)
RELEASE_TAR = $(REPO)/archive/$(VERSION).tar.gz
GIT_STATUS := $(shell git status -s)
Expand Down
9 changes: 7 additions & 2 deletions Sources/LocheckCommand/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,16 @@
//

import ArgumentParser
import Darwin
import Files
import Foundation
import LocheckLogic

#if os(Linux) || os(FreeBSD)
import func Glibc.exit
#else
import func Darwin.exit
#endif

let version = "0.9.11"

struct Locheck: ParsableCommand {
Expand Down Expand Up @@ -42,7 +47,7 @@ private func withProblemReporter(
block(problemReporter)
if problemReporter.hasError || (treatWarningsAsErrors && problemReporter.hasWarning) {
print("Errors found")
Darwin.exit(1)
exit(1)
}
print("Finished validating")
}
Expand Down
10 changes: 8 additions & 2 deletions Sources/LocheckLogic/ProblemReporter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,16 @@
// Created by Steve Landey on 8/18/21.
//

import func Darwin.fputs
import var Darwin.stderr
import Foundation

#if os(Linux) || os(FreeBSD)
import func Glibc.fputs
import var Glibc.stderr
#else
import func Darwin.fputs
import var Darwin.stderr
#endif

private struct StderrOutputStream: TextOutputStream {
mutating func write(_ string: String) {
fputs(string, stderr)
Expand Down

0 comments on commit 81343ed

Please sign in to comment.