Last active
December 19, 2015 11:09
-
-
Save joshkunz/5945579 to your computer and use it in GitHub Desktop.
newLISP issue.
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
$ newlisp test.lsp | |
Reading first line... | |
Started! | |
Reading second line... |
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
import sys | |
# Print started to standard out and | |
# flush the pipe | |
sys.stdout.write("Started!\n") | |
sys.stdout.flush() | |
# Read data from standard-in until EOF is encountered | |
sys.stdin.read() | |
# Write message to standard out | |
sys.stdout.write("Done with data!\n") | |
sys.stdout.flush() | |
# exit |
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
(set 'py-path (append (first (exec "which python")) " pytool.py")) | |
(set 'test-data "Some text") | |
; Build the input and output pipes | |
(map set '(read1 write1) (pipe)) | |
(map set '(read2 write2) (pipe)) | |
; Give the process read1 for standard-in and | |
; write2 for standard out | |
(set 'py (process py-path read1 write2)) | |
; Write our data to the process | |
(write-line write1 test-data) | |
(println "Reading first line...") | |
(println (read-line read2)) | |
; Close the standard-in of the remote process. By my understanding, | |
; this should close the stdin of the sub-process triggering | |
; an EOF event. | |
(close read1) | |
(println "Reading second line...") | |
(println (read-line read2)) ; <-- Process hangs here | |
; Destroy the process | |
(destroy md) | |
(exit) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment