Browse Source

Update sargraph.py.

check-vt100
Peter Gielda 7 years ago
parent
commit
982aa785dc
  1. 12
      sargraph.py

12
sargraph.py

@ -68,13 +68,17 @@ if len(sys.argv) > 1:
with open("data.txt", "r") as f: with open("data.txt", "r") as f:
gpid = int(f.readline().decode().split(", machine:")[0].split("pid: ")[1]) gpid = int(f.readline().decode().split(", machine:")[0].split("pid: ")[1])
except: except:
print("Error: cannot find pid.") print("Warning: cannot find pid. Probably 'data.txt' does not exist.")
sys.exit(1) gpid = -1
p = subprocess.Popen(["screen", "-S", sid, "-X", "stuff", "q\n"]) p = subprocess.Popen(["screen", "-S", sid, "-X", "stuff", "q\n"])
while p.poll() is None: while p.poll() is None:
time.sleep(0.1) time.sleep(0.1)
while pid_running(gpid): if gpid == -1:
time.sleep(0.25) print("Waiting 3 seconds.")
time.sleep(3)
else:
while pid_running(gpid):
time.sleep(0.25)
elif cmd == "label": elif cmd == "label":
print("Adding label '%s' to sargraph session '%s'." % (label, sid)) print("Adding label '%s' to sargraph session '%s'." % (label, sid))
p = subprocess.Popen(["screen", "-S", sid, "-X", "stuff", "%s\n" % label]) p = subprocess.Popen(["screen", "-S", sid, "-X", "stuff", "%s\n" % label])

Loading…
Cancel
Save