add an entry for the monitor server. this value will be needed at the nodes.
[myplc.git] / mtail.py
index 473d160..0e5b423 100755 (executable)
--- a/mtail.py
+++ b/mtail.py
@@ -109,7 +109,10 @@ example:
                    self.files[filename]['size']=size
                elif size < offset:
                    self.show_file_when_size_decreased(filename,offset,size)
-               del self.files[filename]['old-file']
+                try:
+                    del self.files[filename]['old-file']
+                except:
+                    pass
            else:
                # enter file with current size
                # if we didn't set format yet, it's because we are initializing
@@ -136,7 +139,11 @@ example:
            print sys.argv[0],": WARNING : no file in scope"
            self.format="%s"
        else:
-           self.margin=max(*[len(f) for f in filenames])
+           if len(filenames)==1:
+                self.margin=len(filenames[0])
+            else:
+                # this stupidly fails when there's only 1 file
+                self.margin=max(*[len(f) for f in filenames])
            self.format="%%%ds"%self.margin
            if self.options.verbose:
                print 'Current set of files:',filenames