diff --git a/collects/net/sendurl.ss b/collects/net/sendurl.ss index a378d90f28..1e4c812576 100644 --- a/collects/net/sendurl.ss +++ b/collects/net/sendurl.ss @@ -18,9 +18,23 @@ [current-error-port null-output] [current-output-port null-output]) (cond - [(eq? (system-type) 'macos) - ;; actually, I think GURL means something slightly different... - (send-event "MACS" "GURL" "GURL" str)] + [(eq? (system-type) 'macos) + (let loop ([l '("NAVG" "MSIE")]) + (if (null? l) + (error 'send-url "couldn't start Internet Explorer or Netscape") + (with-handlers ([not-break-exn? (lambda (x) (loop (cdr l)))]) + (subprocess #f #f #f "by-id" (car l)) + (let loop ([retries 2]) ;; <<< Yuck <<< + (if (zero? retries) + (error "enough already") ; caught above + (with-handlers ([not-break-exn? (lambda (x) + (loop (sub1 retries)))]) + (let ([t (thread (lambda () + (send-event (car l) "GURL" "GURL" str)))]) + (object-wait-multiple 1 t) ;; <<< Yuck (timeout) <<< + (when (thread-running? t) + (kill-thread t) + (error "timeout")))))))))] [(or (eq? (system-type) 'macosx) (equal? "ppc-macosxonx" (system-library-subpath))) (system (format "osascript -e 'open location \"~a\"'" str))]