<commit_before>#lang racket/base
(require racket/match
         racket/place
         rackunit)

(define (racket-subprocess o i e . args)
  (define (current-executable-path)
    (parameterize ([current-directory (find-system-path 'orig-dir)])
      (find-executable-path (find-system-path 'exec-file) #f)))

  (apply subprocess o i e (current-executable-path) args))

(provide main)
(define (main)
  (test-case
    "test file descriptors copied across place channesl"
;; write out "fdt.rkt"
    (with-output-to-file "fdt.rkt" #:exists 'replace (lambda ()
      (display
#<<END
#lang racket/base
(define (write-flush x [p (current-output-port)])
  (write x p)
  (flush-output p))

(sleep 3)
(with-handlers ([exn? (lambda (e) (eprintf "Child Read Exception Caught ~e\n" e))])
  (fprintf (current-error-port) "ChildRead1 ~a\n" (read)))
(with-handlers ([exn? (lambda (e) (eprintf "Child Read Exception Caught ~e\n" e))])
  (fprintf (current-error-port) "ChildRead2 ~a\n" (read)))
;(close-input-port)

(sleep 3)
(with-handlers ([exn? (lambda (e) (eprintf "Child Write StdOut Exception Caught ~e\n" e))])
  (write-flush "ByeO"))
(with-handlers ([exn? (lambda (e) (fprintf "Child Write StdErr Exception Caught ~e\n" e))])
  (write-flush "ByeE" (current-error-port)))
END
)))

    (define (write-flush x [port (current-output-port)])
      (write x port)
      (flush-output port))

    (define p
      (place ch
        (match (place-channel-get ch)
          [(list in out)
           (with-handlers ([exn? (lambda (e) (printf "Place Write Exception Caught ~e\n" e) (raise e))])
             (write "BFrom Place" out)
             (flush-output out))
             (close-output-port out)])))
<commit_msg>Change stderr output to logging, to please drdr<commit_after>#lang racket/base
(require racket/match
         racket/place
         rackunit)

(define (racket-subprocess o i e . args)
  (define (current-executable-path)
    (parameterize ([current-directory (find-system-path 'orig-dir)])
      (find-executable-path (find-system-path 'exec-file) #f)))

  (apply subprocess o i e (current-executable-path) args))

(provide main)
(define (main)
  (test-case
    "test file descriptors copied across place channesl"
;; write out "fdt.rkt"
    (with-output-to-file "fdt.rkt" #:exists 'replace (lambda ()
      (display
#<<END
#lang racket/base
(define (write-flush x [p (current-output-port)])
  (write x p)
  (flush-output p))

(sleep 3)
(with-handlers ([exn? (lambda (e) (eprintf "Child Read1 Exception Caught ~e\n" e))])
  (define r (read))
  (log-debug (format "Child Read1 ~a\n" r)))
(with-handlers ([exn? (lambda (e) (eprintf "Child Read2 Exception Caught ~e\n" e))])
  (define r (read))
  (log-debug (format "Child Read2 ~a\n" r)))
;(close-input-port)

(sleep 3)
(with-handlers ([exn? (lambda (e) (eprintf "Child Write StdOut Exception Caught ~e\n" e))])
  (write-flush "ByeO"))
(with-handlers ([exn? (lambda (e) (eprintf "Child Write StdErr Exception Caught ~e\n" e))])
  (log-debug "ByeE"))
END
)))

    (define (write-flush x [port (current-output-port)])
      (write x port)
      (flush-output port))

    (define p
      (place ch
        (match (place-channel-get ch)
          [(list in out)
           (with-handlers ([exn? (lambda (e) (printf "Place Write Exception Caught ~e\n" e) (raise e))])
             (write "BFrom Place" out)
             (flush-output out))
             (close-output-port out)])))

{'fraction_non_alphanumeric': 0.16515638702133878, 'fraction_numerical': 0.0029231218941829875, 'mean_word_length': 3.2403965303593556, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2639595', 'n_tokens_mistral': 1261, 'n_tokens_neox': 1218, 'n_words': 356}