DrRacket disallows network and filesystem access during its online expansion. Partly for security reasons and partly because it seems unlikely that the code one writes that does that would be kill safe. You might be able to bike the abstractions you news via the FFI but I guess it will be hard to get right because DrRacket just kills off compilations effectively randomly.
Robby On Thu, Nov 1, 2018 at 5:57 PM Alex Knauth <alexan...@knauth.org> wrote: > Is it possible to create a temporary file, write to it, run a command on > it, and the possibly delete the file from within a macro? Or is it possible > to run a command (as in `system`) in a context where it pretends that some > file exists? > > And, how does this play with DrRacket's background expansion? > > The reason I'm thinking about this is that I want to call out to an > external compiler (for a language other than racket, not implemented in > racket), get information back from that compiler, and display that > information in the form of DrRacket's mouse-over-tooltips. > > I tried this, and it said "forbidden (write) access" to the temporary file > name that it generated. I get this error from DrRacket's background > expansion. > > Is there a way to do this in a way I can use while generating DrRacket > tooltips? > > #lang racket > (require (for-syntax racket/file)) > > (define-syntax m > (λ (stx) > (define tmp (make-temporary-file)) > (display-to-file "hello there\n" tmp #:exists 'replace) > #'(begin))) > > (m) > ;open-output-file: forbidden (write) access to > ;/var/folders/6f/5335m44s43g1zd2vqs7jmqsh0000gp/T/unsaved > editor-7-16_15411123141541112314481 > > Alex Knauth > > -- > You received this message because you are subscribed to the Google Groups > "Racket Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to racket-users+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.