#!/usr/bin/newlisp (define (test-pipe) (write-file "pipe-child.lsp" [text] (set 'msg (read-line (int (nth 2 (main-args))))) (write-line (int (nth 3 (main-args))) (upper-case msg)) (exit) [/text] ) (and (set 'channel (pipe)) (set 'in (first channel)) (set 'out (last channel)) (if (find ostype '("Windows" "OS/2")) (process (string "newlisp pipe-child.lsp " in " " out)) (process (string "./newlisp pipe-child.lsp " in " " out))) (sleep 1000) (write-line out (dup "hello there " 1000)) (sleep 1000) (= (read-line in) (dup "HELLO THERE " 1000)) (delete-file "pipe-child.lsp") ) ) ;(if (find ostype '("Linux" "BSD" "OSX" "Solaris" "SunOS" "Aix" "True64Unix" "Cygwin")) ; (define (test-pipe) ; (set 'channel (pipe)) ; (set 'in (first channel)) ; (set 'out (last channel)) ; (fork (write-line out (upper-case (read-line in)))) ; (write-line out "hello there") ; (sleep 2000) ; (= (read-line in) "HELLO THERE") ; ) ;) (println "test-pipe => " (test-pipe)) (exit)