Skip to content
New issue

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

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

Already on GitHub? # to your account

Multiple line output for spin #151

Closed
jasonvarga opened this issue May 29, 2024 · 4 comments
Closed

Multiple line output for spin #151

jasonvarga opened this issue May 29, 2024 · 4 comments
Assignees

Comments

@jasonvarga
Copy link

Laravel Prompts Version

0.1.23

Laravel Version

11.9.1

PHP Version

8.3.7

Operating System & Version

Ubuntu

Terminal Application

Forge

Description

When using a command with spin() in Forge's deployment script, the output in Forge's logs shows a line for every "frame" of the spin.

image

This doesn't happen when ssh'ing in and running the command manually. The spinner works fine.

I'm not sure where the issue really lies. In our implementation, Laravel's setup of Prompts, or Forge.

Our implementation code is quite simple:

use function Laravel\Prompts\spin;

spin(callback: fn () => Stache::warm(), message: 'Warming the Stache...');

Steps To Reproduce

  • Create a site in forge
  • Add a command that uses spin() to the deployment script
  • View deployment log
@jbrooksuk
Copy link
Member

This isn't really a bug of Prompts, more a side-effect of how Forge reads the deployment output. During a deployment, Forge pipes output to a file which the CLI reads via the API. Writing to files means that there is no support for the interactive or ANSI codes that replace the spinner in situ.

When running any interactive commands like this, I'd recommend adding the --no-progress or --no-ansi options.

@DanielDarrenJones
Copy link

@jbrooksuk --no-progress doesn't seem to be an allowed flag, and --no-ansi doesn't seem to have any affect when testing this in Laravel Forge

@jbrooksuk
Copy link
Member

@DanielDarrenJones when you say --no-ansi doesn't have any effect, what happens?

@DanielDarrenJones
Copy link

@jbrooksuk
image
It still outputs the spinner and a new line every time in the deployment log

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

5 participants