skupper icon indicating copy to clipboard operation
skupper copied to clipboard

skupper init should detect when not running in foreground with tty

Open hash-d opened this issue 2 years ago • 1 comments

Describe the bug

With 1.5, skupper init now shows a helpful Waiting for status... message. However, the message is shown even if the command was run on background. The result is that the user will have to wait for the init command to finish before they can properly use that terminal again, as the message is updated several times each second.

How To Reproduce

$ skupper init &
Waiting for status...|
Waiting for status.../
Waiting for status.../
Waiting for status...\
Waiting for status...\
Waiting for status...-
Waiting for status...\
Wed 13 Dec 13:14:33 -03 2023
Waiting for status...
Skupper is now installed in namespace 'dh-new'.  Use 'skupper status' to get more information.

Notice the different Waiting for status... messages above are a product of hitting ENTER, and the date is a result of running the date command while the skupper init ran in the background. During that time, it was impossible to see what had been typed at the prompt.

Expected behavior

It's normal for commands to print messages while running the background. However, that status message should be avoided in this case, as it negates the use of the background execution of skupper init

Environment details

  • Skupper CLI: 1.5.1
  • Platform: any

Additional context

hash-d avatar Dec 13 '23 16:12 hash-d

On my testing, when I redirected the output to a file, I did not see the messages there. However, I do not know whether that was because it's already recognizing a non-tty stdout, or simply because it was never flushed to disk (due to the way the message gets updated).

hash-d avatar Dec 13 '23 16:12 hash-d