Skip to content

Commit

Permalink
Require newer Racket on macOS Sequoia
Browse files Browse the repository at this point in the history
This is a mitigation for the situation described in issue #722.

Already the back end refuses to run unless we have a minimum version
of Racket. On macOS Sequoia, require a newer version.
  • Loading branch information
greghendershott committed Sep 24, 2024
1 parent 5876720 commit 35f3817
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions racket/main.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,35 @@

(require racket/match
racket/port
(only-in racket/string string-trim)
(only-in racket/system system/exit-code)
version/utils
"command-server.rkt"
(only-in "image.rkt" set-use-svg?!))

(module+ main
;; Assert Racket minimum version
(define minimum-version "6.12")
(define (assert-racket-version minimum-version)
(define actual-version (version))
(unless (version<=? minimum-version actual-version)
(error '|Racket Mode back end| "Need Racket ~a or newer but ~a is ~a"
minimum-version
(find-executable-path (find-system-path 'exec-file))
actual-version))
actual-version)))

(define (macos-sequoia-or-newer?)
(and (eq? 'macosx (system-type 'os))
;; Note: This is conservative; will return false if `sw_vers`
;; can't be found or doesn't produce a valid version string.
(let ([out (open-output-string)])
(parameterize ([current-output-port out])
(and (zero? (system/exit-code "sw_vers -productVersion"))
(let ([ver (string-trim (get-output-string out))])
(and (valid-version? ver)
(version<=? "15.0" ver))))))))

(module+ main
(assert-racket-version (if (macos-sequoia-or-newer?)
"8.14.0.4" ;issue #722
"6.12")) ;general requirement

;; Command-line flags (from Emacs front end invoking us)
(match (current-command-line-arguments)
Expand Down

0 comments on commit 35f3817

Please sign in to comment.