[Git][NTPsec/ntpsec][master] 2 commits: ntpviz: no need to set pipe buffer size.

Gary E. Miller gitlab at mg.gitlab.com
Tue Oct 18 18:39:59 UTC 2016


Gary E. Miller pushed to branch master at NTPsec / ntpsec


Commits:
3f00b223 by Gary E. Miller at 2016-10-18T11:38:38-07:00
ntpviz: no need to set pipe buffer size.

The default actually is the best size.

- - - - -
02cf41d8 by Gary E. Miller at 2016-10-18T11:38:38-07:00
ntpviz: silently ignore missing summary.csv, index.html

On first run these two files will not exist.

- - - - -


1 changed file:

- ntpstats/ntpviz


Changes:

=====================================
ntpstats/ntpviz
=====================================
--- a/ntpstats/ntpviz
+++ b/ntpstats/ntpviz
@@ -269,8 +269,8 @@ def gnuplot(template, outfile=None):
     # would be great to capture stderr, but the Python doc says
     # that can lead to deadlock on large stderr output.  gnuplot
     # can output a lot to stderr...
-    proc = subprocess.Popen("gnuplot",
-                            shell=False, bufsize=4096,
+    # bigger buffers make it slower, use the default
+    proc = subprocess.Popen("gnuplot", shell=False,
                             stdin=subprocess.PIPE, stdout=out)
     v = sys.version_info
     if 3 <= v[0]:
@@ -1477,7 +1477,7 @@ ntpviz</a>, part of the <a href="https://www.ntpsec.org/">NTPsec project</a>
         # your webserver should be programmed the same
         index_buffer += """\
 </table>
-<a href="summary.csv" target="_blank" 
+<a href="summary.csv" target="_blank"
   type="text/csv;charset=UTF-8;header=present;">Summary as CSV file</a><br>
 </div>
 """
@@ -1508,10 +1508,13 @@ ntpviz</a>, part of the <a href="https://www.ntpsec.org/">NTPsec project</a>
 
     # move new index and summary into place
     # windows python 2.7, 3.6 has no working rename, so delete and move
-    os.remove(csv_filename)
-    os.rename( csv_filename + ".tmp", csv_filename)
+    try:
+        os.remove(csv_filename)
+        os.remove( index_filename)
+    except:
+        pass
 
-    os.remove( index_filename)
+    os.rename( csv_filename + ".tmp", csv_filename)
     os.rename( index_filename + ".tmp", index_filename)
 
 



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/d1423b04f9568709447ca160123c25bf22ee0b13...02cf41d8fa011dc8c59adbb5cfc31f349b31d843
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20161018/977965f2/attachment.html>


More information about the vc mailing list