<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi.<div><br></div><div>Here's my Racket implementation of:</div><div><br></div><div>sh:> md5 -q README.md > README.md.md5</div><div><br></div><div>scsh:> (run (md5 -q README.md) (> README.md.md5))<br><br><blockquote type="cite"><div><font class="Apple-style-span" color="#000000"> (begin</font></div><div><font class="Apple-style-span" color="#000000">   (define md5 (find-executable-path "md5" #f))</font></div><div><font class="Apple-style-span" color="#000000">   (define infile "README.md")</font></div><div><font class="Apple-style-span" color="#000000">   (define outfile "README.md.md5")   </font></div><div><font class="Apple-style-span" color="#000000">   (parameterize </font></div><div><font class="Apple-style-span" color="#000000">       ([current-custodian (make-custodian)])</font></div><div><font class="Apple-style-span" color="#000000">     (current-subprocess-custodian-mode #f)</font></div><div><font class="Apple-style-span" color="#000000">     (let*-values</font></div><div><font class="Apple-style-span" color="#000000">         ([(to) (open-output-file outfile #:mode 'text #:exists 'replace)]</font></div><div><font class="Apple-style-span" color="#000000">          [(sub in out err) (subprocess to #f 'stdout md5 "-q" infile)])</font></div><div><font class="Apple-style-span" color="#000000">       (begin</font></div><div><font class="Apple-style-span" color="#000000">         (subprocess-wait sub)</font></div><div><font class="Apple-style-span" color="#000000">         (custodian-shutdown-all (current-custodian))</font></div><div><font class="Apple-style-span" color="#000000">         (subprocess-status sub))))))</font></div></blockquote></div><div><br></div><div>I could of course cheat:</div><div><blockquote type="cite"><font class="Apple-style-span" color="#000000">(system "md5 -q README.md > README.md.md5")</font></blockquote><br></div><div>Can my code be improved? Source <a href="https://github.com/vkz/rash/blob/master/examples/examples.rkt">on github</a> if you want to play with it.</div><div>I hope to add more examples.</div><div><div apple-content-edited="true">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">---</div><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Vlad Kozin <<a href="mailto:vladilen.kozin@gmail.com">vladilen.kozin@gmail.com</a>><br><br><br></div></div>
</div>
<br></div></body></html>