$ rlwrap csi
#;1> (import (prefix (chicken process) p:))
; loading /usr/local/Cellar/chicken/5.0.0/lib/chicken/9/chicken.process.import.so ...
#;2> (p:system "ls")
Applications Library bin
0
#;3> (p:system "./foo")
sh: ./foo: No such file or directory
32512
#;4> (p:system* "./foo")
sh: ./foo: No such file or directory
(import (prefix (chicken process) p:))
#;4> (define foo (p:open-input-pipe "ls -al" #:text))
#;5> (read-line foo)
Error: unbound variable: read-line
Call history:
<syntax> (read-line foo)
<eval> (read-line foo) <--
#;5> (import (chicken io))
; loading /usr/local/Cellar/chicken/5.0.0/lib/chicken/9/chicken.io.import.so ...
#;6> (read-line foo)
"total 1120"
#;7> (read-line foo)
"drwxr-xr-x+ 118 idas staff 4012 Dec 14 19:28 ."
#;8> (read-line foo)
"lrwxr-xr-x 1 idas staff 33 Apr 30 2018 .#talk.org -> idas@Niels-MacBook-Pro.local.6142"
#;9> (close-input-port foo)
2
#;10> (read-line foo)
Error: (read-line) port already closed: #<input port "(pipe)">
Call history:
<syntax> (read-line foo)
<eval> (read-line foo) <--
Last active
January 2, 2019 18:13
-
-
Save indraniel/973ae601fb5d35b830fc3c0c5e075956 to your computer and use it in GitHub Desktop.
Chicken Scheme scratches
Need to set at the top of file:
;; -*- geiser-scheme-implementation: 'chicken -*-
See https://github.com/jaor/geiser/issues/130 for more details.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#| | |
exec /usr/local/bin/csi -ss "$0" "$@" | |
|# | |
; http://wiki.call-cc.org/man/5/Using%20the%20interpreter | |
(import (prefix (chicken process) p:) | |
(chicken process-context)) | |
(define (testit) | |
(p:system "ls") | |
(newline) | |
(display (string-append "environment -- USER=" | |
(get-environment-variable "USER"))) | |
(newline) | |
(display "All Done!") | |
(newline)) | |
(define (main args) | |
(testit)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment