Search code examples
racketraco

how to run raco command from a script?


What's the preferred way to run a raco command from a script?

I've been doing things like:

#lang racket
(system "raco frog -b")

but there has got to be a better solution.


Solution

  • Yes indeed, there is a better way:

    #lang racket
    (require raco/all-tools)
    (define v (all-tools))
    (parameterize ([current-command-line-arguments (vector "-b")])
      (dynamic-require (second (hash-ref v "frog")) #f))
    

    Many thanks to Sam Tobin-Hochstadt.

    https://github.com/racket/racket-lang-org/pull/26#issuecomment-267160884