Project

General

Profile

Actions

Bug #24474

open

Commands print task progress into stderr

Added by Ondřej Pražák almost 6 years ago. Updated almost 6 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Difficulty:
Triaged:
No
Fixed in Releases:
Found in Releases:

Description

Commands that use foreman-tasks print the task progress to stderr. This makes checking for command errors a bit difficult. I expect only errors to go into error output, the progress should go into stdout.

Steps to reproduce:
1) hammer subscription refresh-manifest --organization 'Default Organization' 2>err.txt 1>out.txt
2) cat out.txt # will be empty
3) cat err.txt
Task 7e4e06b0-0624-4dd1-a415-d4b1567f14c5 running: 0.0/1, 0%, elapsed: 00:00:00
Task 7e4e06b0-0624-4dd1-a415-d4b1567f14c5 running: 0.09074410163339383/1, 9%, 0.0/s, elapsed: 00:00:02, ETA: 00:00:21
Task 7e4e06b0-0624-4dd1-a415-d4b1567f14c5 running: 0.18148820326678766/1, 18%, 0.0/s, elapsed: 00:00:09, ETA: 00:00:29
Task 7e4e06b0-0624-4dd1-a415-d4b1567f14c5 running: 0.18148820326678766/1, 18%, 0.0/s, elapsed: 00:00:11, ETA: 00:00:43
Task 7e4e06b0-0624-4dd1-a415-d4b1567f14c5 running: 0.2722323049001815/1, 27%, 0.0/s, elapsed: 00:00:13, ETA: 00:00:29
Task 7e4e06b0-0624-4dd1-a415-d4b1567f14c5 running: 0.2722323049001815/1, 27%, 0.0/s, elapsed: 00:00:15, ETA: 00:00:36
Task 7e4e06b0-0624-4dd1-a415-d4b1567f14c5 running: 0.2722323049001815/1, 27%, 0.0/s, elapsed: 00:00:17, ETA: 00:00:44
Task 7e4e06b0-0624-4dd1-a415-d4b1567f14c5 running: 0.2722323049001815/1, 27%, 0.0/s, elapsed: 00:00:19, ETA: 00:01:17
Task 7e4e06b0-0624-4dd1-a415-d4b1567f14c5 running: 0.2722323049001815/1, 27%, 0.0/s, elapsed: 00:00:21, ETA: 00:01:41
Task 7e4e06b0-0624-4dd1-a415-d4b1567f14c5 running: 0.2722323049001815/1, 27%, 0.0/s, elapsed: 00:00:23, ETA: 00:01:41
Task 7e4e06b0-0624-4dd1-a415-d4b1567f14c5 running: 0.2722323049001815/1, 27%, 0.0/s, elapsed: 00:00:25
Task 7e4e06b0-0624-4dd1-a415-d4b1567f14c5 running: 0.2722323049001815/1, 27%, 0.0/s, elapsed: 00:00:28
Task 7e4e06b0-0624-4dd1-a415-d4b1567f14c5 running: 0.2722323049001815/1, 27%, 0.0/s, elapsed: 00:00:30
Task 7e4e06b0-0624-4dd1-a415-d4b1567f14c5 running: 0.2722323049001815/1, 27%, 0.0/s, elapsed: 00:00:32
Task 7e4e06b0-0624-4dd1-a415-d4b1567f14c5 running: 0.2722323049001815/1, 27%, 0.0/s, elapsed: 00:00:34
Task 7e4e06b0-0624-4dd1-a415-d4b1567f14c5 running: 0.2722323049001815/1, 27%, 0.0/s, elapsed: 00:00:36
Task 7e4e06b0-0624-4dd1-a415-d4b1567f14c5 running: 0.2722323049001815/1, 27%, 0.0/s, elapsed: 00:00:38
Task 7e4e06b0-0624-4dd1-a415-d4b1567f14c5 running: 0.2722323049001815/1, 27%, 0.0/s, elapsed: 00:00:40
Task 7e4e06b0-0624-4dd1-a415-d4b1567f14c5 running: 0.2722323049001815/1, 27%, 0.0/s, elapsed: 00:00:42
Task 7e4e06b0-0624-4dd1-a415-d4b1567f14c5 running: 0.2722323049001815/1, 27%, 0.0/s, elapsed: 00:00:44
Task 7e4e06b0-0624-4dd1-a415-d4b1567f14c5 running: 0.2722323049001815/1, 27%, 0.0/s, elapsed: 00:00:46
Task 7e4e06b0-0624-4dd1-a415-d4b1567f14c5 running: 0.2722323049001815/1, 27%, 0.0/s, elapsed: 00:00:49
Task 7e4e06b0-0624-4dd1-a415-d4b1567f14c5 running: 0.2722323049001815/1, 27%, 0.0/s, elapsed: 00:00:51
Task 7e4e06b0-0624-4dd1-a415-d4b1567f14c5 running: 0.2722323049001815/1, 27%, 0.0/s, elapsed: 00:00:53
Task 7e4e06b0-0624-4dd1-a415-d4b1567f14c5 running: 0.4537205081669692/1, 45%, 0.0/s, elapsed: 00:00:55
Task 7e4e06b0-0624-4dd1-a415-d4b1567f14c5 success: 1.0/1, 100%, 0.0/s, elapsed: 00:00:57
Task 7e4e06b0-0624-4dd1-a415-d4b1567f14c5 success: 1.0/1, 100%, 0.0/s, elapsed: 00:00:57

Actions #1

Updated by Tomáš Strachota almost 6 years ago

  • Project changed from Hammer CLI to foreman-tasks

Moving to foreman-tasks because the logic from printing task progress lives in `HammerCLIForemanTasks::Async`

Actions #2

Updated by Adam Ruzicka almost 6 years ago

We should probably try and detect whether we have a "live terminal" or not and act accordingly, maybe bring PTY into the play and print the progress to the terminal directly (instead of printing to STDOUT/STDERR)

Actions

Also available in: Atom PDF