-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
enhancementNew feature or requestNew feature or request
Description
When the program code comes from stdin, allow to use ^D (EOT, \u0004, ^V^D when entered in an interactive Unix terminal) as a separator character defining the end of the program and the beginning of stdin as input to the program.
$ printf 'Hello' | goeval 'b,_:=io.ReadAll(os.Stdin);fmt.Printf("[%s]\n", b)'
[Hello]
$ printf 'b,_:=io.ReadAll(os.Stdin);fmt.Printf("[%%s]\\n", b)\004Hello' | goeval -
[Hello]Implementation note: this requires to do either unbuffered read (to not read beyond ^D) or to feed the child program with the remaining buffered data.
$ stty -g | sed 's/.*:\(lnext=[^:]*\):.*/\1/' # ^V definition in terminal settings allowing to use it to escape ^D
lnext=16Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request