Skip to content

Commit 696cb04

Browse files
committed
FreeBSD: Fix setpriority call
The setpriority function call is imported differently on FreeBSD than on Linux or macOS. No type conversions are needed.
1 parent 4fcb707 commit 696cb04

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Sources/TSCExtensions/Process+Run.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,8 @@ private func setProcessPriority(pid: Process.ProcessID, newPriority: TaskPriorit
184184
// can only be elevated, this means that we can effectively only change a process's priority once, when it is created.
185185
// All subsequent calls to `setpriority` will fail. Because of this, don't log an error.
186186
setpriority(PRIO_PROCESS, UInt32(pid), newPriority.posixProcessPriority)
187+
#elseif os(FreeBSD)
188+
setpriority(PRIO_PROCESS, pid, newPriority.posixProcessPriority)
187189
#else
188190
setpriority(__priority_which_t(PRIO_PROCESS.rawValue), UInt32(pid), newPriority.posixProcessPriority)
189191
#endif

0 commit comments

Comments
 (0)