gopherdata / gophernotes

The Go kernel for Jupyter notebooks and nteract.
MIT License
3.85k stars 263 forks source link

Skip output from old print statements #72

Closed SpencerPark closed 7 years ago

SpencerPark commented 7 years ago

Since past statements need to be re executed to maintain that the current cell is executed in the expected state, os.Stdout is redirected to nil during this phase to skip any prints.

Before executing the statements in the current cell, the stream is restored so that only the output from the current cell is captured.

This also removes the cleanEvalStmt which was, in some cases, deleting incorrect print statements such as in

f := func () {
    fmt.Println("test")
}
// In another cell
f()
dwhitena commented 7 years ago

@SpencerPark is this still relevant in v1?

SpencerPark commented 7 years ago

@dwhitena No this applied to the old repl.