Kurukuru icon indicating copy to clipboard operation
Kurukuru copied to clipboard

Blank lines emitted while spinning inside an Alpine Linux container

Open atifaziz opened this issue 5 years ago • 3 comments

When a program is run inside an Alpine Linux container (the case I tested), the spinner emit blank lines and causes scrolling.

Steps to Reproduce

Example program:

using System;
using System.Threading;
using Kurukuru;

static class Program
{
    static void Main() =>
        Spinner.Start("Processing...", () => Thread.Sleep(1000 * 3));
}

Run the .NET Core 3.1 SDK image on Alpine Linux:

docker run --rm -it mcr.microsoft.com/dotnet/core/sdk:3.1-alpine

Once on the shell prompt inside the container image, copy and paste the following:

mkdir Demo
cd Demo
dotnet new console
dotnet add package Kurukuru
cat > Program.cs << EOF
using System;
using System.Threading;
using Kurukuru;

static class Program
{
    static void Main() =>
        Spinner.Start("Processing...", () => Thread.Sleep(1000 * 3));
}
EOF
dotnet run

When dotnet run executes the program, you should notice blank lines being emitted during spinning and possibly scrolling.

Here is what my session looked like:

❯ docker run --rm -it mcr.microsoft.com/dotnet/core/sdk:3.1-alpine
/ # mkdir Demo
/ # cd Demo
/Demo # dotnet new console
Getting ready...
The template "Console Application" was created successfully.

Processing post-creation actions...
Running 'dotnet restore' on /Demo/Demo.csproj...
  Restore completed in 219.52 ms for /Demo/Demo.csproj.

Restore succeeded.

/Demo # dotnet add package Kurukuru
  Writing /tmp/tmpnKJEhm.tmp
info : Adding PackageReference for package 'Kurukuru' into project '/Demo/Demo.csproj'.
info : Restoring packages for /Demo/Demo.csproj...
info :   GET https://api.nuget.org/v3-flatcontainer/kurukuru/index.json
info :   OK https://api.nuget.org/v3-flatcontainer/kurukuru/index.json 458ms
info :   GET https://api.nuget.org/v3-flatcontainer/kurukuru/1.1.0/kurukuru.1.1.0.nupkg
info :   OK https://api.nuget.org/v3-flatcontainer/kurukuru/1.1.0/kurukuru.1.1.0.nupkg 18ms
info : Installing Kurukuru 1.1.0.
info : Package 'Kurukuru' is compatible with all the specified frameworks in project '/Demo/Demo.csproj'.
info : PackageReference for package 'Kurukuru' version '1.1.0' added to file '/Demo/Demo.csproj'.
info : Committing restore...
info : Writing assets file to disk. Path: /Demo/obj/project.assets.json
log  : Restore completed in 1.38 sec for /Demo/Demo.csproj.
/Demo # cat > Program.cs << EOF
> using System;
> using System.Threading;
> using Kurukuru;
>
> static class Program
> {
>     static void Main() =>
>         Spinner.Start("Processing...", () => Thread.Sleep(1000));
> }
> EOF
/Demo # dotnet run













✔ Processing...

Notice blank lines between dotnet run and the final ✔ Processing....

atifaziz avatar Aug 26 '20 21:08 atifaziz

FYI, the same issue occurs when the same steps are run in a WSL distribution like Ubuntu 16.04.

If you don't have .NET Core SDK setup in your Ubuntu on WSL, you can do so by running the following commands on the BASH shell:

wget -q https://dot.net/v1/dotnet-install.sh
chmod +x dotnet-install.sh
./dotnet-install.sh --version 3.1.401
export PATH="$PATH:$HOME/.dotnet"

Then proceed with the same steps as shown in my original comment to create and run a demo application:

mkdir Demo
cd Demo
dotnet new console
dotnet add package Kurukuru
cat > Program.cs << EOF
using System;
using System.Threading;
using Kurukuru;

static class Program
{
    static void Main() =>
        Spinner.Start("Processing...", () => Thread.Sleep(1000 * 3));
}
EOF
dotnet run

atifaziz avatar Aug 26 '20 21:08 atifaziz

Below is a recording of an Ubuntu (on WSL) session depicting the steps above and the issue, and which you can playback by just clicking the image.

asciicast

atifaziz avatar Aug 26 '20 22:08 atifaziz

Having the same behaviour on OSX 10.15.7 + dotnet 5.0.0

bnygld avatar Dec 11 '20 09:12 bnygld