Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should show error message and not loop when there's an error #14

Open
dreammaker opened this issue Sep 26, 2017 · 0 comments
Open

Should show error message and not loop when there's an error #14

dreammaker opened this issue Sep 26, 2017 · 0 comments

Comments

@dreammaker
Copy link

dreammaker commented Sep 26, 2017

When the gnuplot program generates an error that isn't output instantly, GnuplotRB::Plot#plot loops forever and never displays the error message. This can come up in a number of ways and is particularly sinister because it hides the root cause of many different problems.

The code is reading the output of a separate process, so depending on execution order, you may not run into this problem. Sometimes just running it again works. But many times, it doesn't.

This may be somewhat related to #10. But I was trying to create a heatmap and ran into this. After hacking around it, I found that it's not related to a specific type of plot, but any error.

This is my workaround:

diff --git a/lib/gnuplotrb/plot.rb b/lib/gnuplotrb/plot.rb
index 1fb46f6..1809107 100644
--- a/lib/gnuplotrb/plot.rb
+++ b/lib/gnuplotrb/plot.rb
@@ -79,6 +79,7 @@ module GnuplotRB
       ds_string = @datasets.map { |dataset| dataset.to_s(terminal) }.join(' , ')
       full_command = @cmd + ds_string
       terminal.set(inner_opts).stream_puts(full_command).unset(inner_opts.keys)
+      sleep 1
       if inner_opts[:output]
         # guaranteed wait for plotting to finish
         terminal.close unless term

It's unsatisfactory because it sleeps unnecessarily, especially in non-error cases.

I think many people would appreciate having this fixed since showing the underlying error message is crucial, especially for new users (like me) who aren't familiar with what options they should be using. What ends up happening is people experiment with different options to see what happens. Unfortunately, as it is now, that often causes them to get stuck, not knowing how to proceed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant