Merge ~pwlars/testflinger-cli:unbuffer-poll-only into testflinger-cli:master

Proposed by Paul Larson
Status: Merged
Approved by: Maciej Kisielewski
Approved revision: dffb7f7eec4decb0a76071bf1001663e98f7bb83
Merged at revision: dffb7f7eec4decb0a76071bf1001663e98f7bb83
Proposed branch: ~pwlars/testflinger-cli:unbuffer-poll-only
Merge into: testflinger-cli:master
Diff against target: 19 lines (+2/-2)
1 file modified
testflinger-cli (+2/-2)
Reviewer Review Type Date Requested Status
Maciej Kisielewski (community) Approve
Review via email: mp+316474@code.launchpad.net

Description of the change

python -u was causing some problems, and it looks like re-opening sys.stdout doesn't work well with python3. However, I think we are really only concerned about making sure we don't buffer output when running with poll. That way Jenkins jobs and things like that don't get buffered in the output stream from this.

To post a comment you must log in.
Revision history for this message
Maciej Kisielewski (kissiel) wrote :

awesome sauce

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/testflinger-cli b/testflinger-cli
2index 126332e..b0e8f0e 100755
3--- a/testflinger-cli
4+++ b/testflinger-cli
5@@ -1,4 +1,4 @@
6-#!/usr/bin/env python3 -u
7+#!/usr/bin/env python3
8 # Copyright (C) 2017 Canonical
9 #
10 # This program is free software: you can redistribute it and/or modify
11@@ -143,7 +143,7 @@ def poll(ctx, job_id):
12 # We are still waiting for the job to start
13 pass
14 if output:
15- print(output, end='')
16+ print(output, end='', flush=True)
17 job_state = conn.get_status(job_id)
18 if job_state == 'complete':
19 break

Subscribers

People subscribed via source and target branches