1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-04-27 16:51:06 -07:00

Try to open the telemetry file before creating the gui and thread, so that the error appears immediately.

Copied from Perforce
 Change: 194234
This commit is contained in:
Gareth Rees 2018-06-27 11:36:41 +01:00
parent 76db61222d
commit 791308ab8f

View file

@ -553,28 +553,29 @@ def main():
default=os.environ.get('MPS_TELEMETRY_FILENAME', 'mpsio.log'),
help="telemetry output from the MPS instance")
args = parser.parse_args()
event_queue = queue.Queue()
stop = threading.Event()
def decoder_thread():
with open(args.telemetry, 'rb') as f:
decoder = telemetry_decoder(f.read)
with open(args.telemetry, 'rb') as telemetry_file:
event_queue = queue.Queue()
stop = threading.Event()
def decoder_thread():
decoder = telemetry_decoder(telemetry_file.read)
while not stop.isSet():
for batch in decoder():
if stop.isSet():
break
event_queue.put(batch)
thread = threading.Thread(target=decoder_thread)
thread.start()
model = Model(event_queue)
qapp = QtWidgets.QApplication([])
app = ApplicationWindow(model, args.telemetry)
app.show()
result = qapp.exec_()
stop.set()
thread.join()
return result
thread = threading.Thread(target=decoder_thread)
thread.start()
model = Model(event_queue)
qapp = QtWidgets.QApplication([])
app = ApplicationWindow(model, args.telemetry)
app.show()
result = qapp.exec_()
stop.set()
thread.join()
return result
if __name__ == '__main__':