Illegal instruction in Linux
Closed this issue · 1 comments
kirilltitov commented
This code works in macOS, but results in Illegal instruction
in Linux (official Swift 4.2.1 Docker image):
import Foundation
import Signals
let semaphore = DispatchSemaphore(value: 0)
class Signaler {
static func execute() {
semaphore.signal()
}
}
// crashes even if closure is empty
Signals.trap(signals: [.int, .term]) { s in
print("Trapped \(s)")
Signaler.execute()
}
print("Now we wait")
semaphore.wait()
print("Bye!")
However, classic signal
works fine both in macOS and Linux:
import Foundation
let semaphore = DispatchSemaphore(value: 0)
class Signaler {
static func execute() {
semaphore.signal()
}
}
let trap: @convention(c) (Int32) -> Void = { s in
print("Received signal \(s)")
Signaler.execute()
}
signal(SIGINT, trap)
signal(SIGTERM, trap)
print("Now we wait")
semaphore.wait()
print("Bye!")
alex-taffe commented
I’m having a similar issue, any luck on this?
Edit: had nothing to do with BlueSignals, it was just a nil in my code that was causing it to crash, compiling in debug mode showed the issue