Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pipeline output is not displayed until a newline is reached #2743

Open
jackwilsdon opened this issue Oct 20, 2023 · 3 comments
Open

Pipeline output is not displayed until a newline is reached #2743

jackwilsdon opened this issue Oct 20, 2023 · 3 comments
Labels
kind/bug Something isn't working

Comments

@jackwilsdon
Copy link
Contributor

What happened?
Text printed from a pipeline is not output to the terminal until a newline is reached.

What did you expect to happen instead?
Text should be printed without needing a newline.

How can we reproduce the bug? (as minimally and precisely as possible)

  1. Create this devspace.yaml:
    version: v2beta1
    pipelines:
      test: |
        echo -n "Text without a newline"
        sleep 1
        echo "... finished!"
  2. Run devspace run-pipeline test
  3. Note that "Text without a newline" doesn't appear until "... finished!" is printed

Local Environment:

  • DevSpace Version: 6.3.3
  • Operating System: macOS Sonoma 14.0
  • ARCH of the OS: arm64

Anything else we need to know?
This is a bigger issue when using read -p "Some prompt here: ", as the prompt doesn't appear until the user has hit enter (completing the read).

@jackwilsdon jackwilsdon added the kind/bug Something isn't working label Oct 20, 2023
@jackwilsdon
Copy link
Contributor Author

jackwilsdon commented Oct 20, 2023

From what I can tell, this is caused by this code (Scan only returns when it finds a newline):

parent.Go(func() error {
s := scanner.NewScanner(stdoutReader)
for s.Scan() {
ctx.Log().Info(s.Text())
}
return nil
})

Not sure what the right fix is, as it seems like pkg/util/log doesn't have any support for logging without a newline.

@lizardruss
Copy link
Collaborator

@jackwilsdon Thanks for the analysis! We will take a look at a fix. I had previously assumed that this was an issue with the library we were using for the shell emulation, but you're probably right in that it's the scanner using the ScanLines function to tokenize the reader output.

@lizardruss
Copy link
Collaborator

@jackwilsdon While not a solution for this particular problem, I've found that read -p "Some prompt here: " works as expected in commands. The read values can then be passed into DevSpace using the --var flag. Hope that's helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants