Random `invalid commands` in gnuplot.jl when using vscode

I am getting a weird error, and I can’t seem to reproduce it deterministically.

From a fresh vscode julia repl, I select my code, and press ctrl-enter to execute it. It launches the REPL and runs the commands. I get the following error in gnuplot.jl.

^[[200~using Gnuplot 
Gnuplot.options.verbose = true
@gp "set grid" "set key left"
@gp :- "set size 600, 480"
@gp :- "set title 'Plot title'" "set xlabel 'coverage'" "set xrange [0:*]" "set ylabel 'R0'"
@gp :- "set multiplot layout 2,2"
x = 0:0.1:10 
julia> using Gnuplot

julia> Gnuplot.options.verbose = true
true

julia> @gp "set grid" "set key left"
GNUPLOT (default) print GPVAL_TERM
GNUPLOT (default) -> x11
GNUPLOT (default) print GPVAL_TERMOPTIONS
GNUPLOT (default) unset multiplot
GNUPLOT (default) set output
GNUPLOT (default) reset session
GNUPLOT (default) set term x11 
GNUPLOT (default) print GPVAL_TERM
GNUPLOT (default) -> x11
GNUPLOT (default) print GPVAL_TERMOPTIONS
GNUPLOT (default) ->  nopersist enhanced
GNUPLOT (default) set term x11  nopersist enhanced title 'Gnuplot.jl: default'
GNUPLOT (default) set grid
GNUPLOT (default) set key left
GNUPLOT (default) 
GNUPLOT (default) reset
GNUPLOT (default) set grid
GNUPLOT (default) set key left
GNUPLOT (default) unset multiplot

julia> @gp :- "set size 600, 480"
GNUPLOT (default) set size 600, 480
GNUPLOT (default) 
GNUPLOT (default) reset
GNUPLOT (default) set grid
GNUPLOT (default) set key left
GNUPLOT (default) set size 600, 480
GNUPLOT (default) unset multiplot

julia> @gp :- "set title 'Plot title'" "set xlabel 'coverage'" "set xrange [0:*]" "set ylabel 'R0'"
GNUPLOT (default) set title 'Plot title'
GNUPLOT (default) set xlabel 'coverage'
GNUPLOT (default) set xrange [0:*]
GNUPLOT (default) set ylabel 'R0'
GNUPLOT (default) 
GNUPLOT (default) reset
GNUPLOT (default) set grid
GNUPLOT (default) set key left
GNUPLOT (default) set size 600, 480
GNUPLOT (default) set title 'Plot title'
GNUPLOT (default) set xlabel 'coverage'
GNUPLOT (default) set xrange [0:*]
GNUPLOT (default) set ylabel 'R0'
GNUPLOT (default) unset multiplot

julia> @gp :- "set multiplot layout 2,2"
GNUPLOT (default) set multiplot layout 2,2
GNUPLOT (default) ->            ^
GNUPLOT (default) ->            line 0: invalid command

And the REPL hangs. I have to ctrl-c to interrupt it and sometimes even kill the process.

It dosn’t happen all the time. I am not using the vscode plot pane (gnuplot.options.gpviewer=true), and if I copy paste in my terminal, it works (but also sometimes it dosn’t).

Seems like there a input/output error from the underlying gnuplot process and julia.

@gcal

I have found that if I launch the REPL beforehand (Preferences → Start REPL) and then execute the lines one by one, things seem to work.