Skip to content

Instantly share code, notes, and snippets.

@joshkunz
Last active December 19, 2015 11:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshkunz/5945579 to your computer and use it in GitHub Desktop.
Save joshkunz/5945579 to your computer and use it in GitHub Desktop.
newLISP issue.
$ newlisp test.lsp
Reading first line...
Started!
Reading second line...
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
(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