GreenDjango / blih_cli

CLI for Blih
MIT License
6 stars 0 forks source link

[Bug] SSH deadlock when connecting to an unknown host #13

Closed YannMagnin closed 4 years ago

YannMagnin commented 4 years ago

Using blih_cli version 0.1.2.

When I try to clone a repository when the host fingerprint is not already registered...

> Git clone here ? Yes
The authenticity of host 'git.epitech.eu (xxx.xx.xx.x)' can't be established.
ED25519 key fingerprint is SHA256:WnZatelotilt6A6Fj4GUAjd4vGY5P1wZag/UCa85ROY.
⠴ Clone repository in /tmp...

...a deadlock appear during the clone of the repository (unable to stop the process using CTRL+C).

Normally, when a new connection is set on an unknown host, the same warning is displayed, but with the line Are you sure you want to continue connecting (yes/no/[fingerprint])? then the user can select an action. Here, it seems like blih_cli overwrite the output (or something like this) and avoids user interaction with the warning (manually write yes display nothing but seems to fix the error).

GreenDjango commented 4 years ago
export async function sh(cmd: string): Promise<{ stdout: string; stderr: string }> {
    return new Promise(function(resolve, reject) {
        exec(cmd, (err, stdout, stderr) => {
            if (err) reject(err)
            else resolve({ stdout, stderr })
        })
    })
}

The cmd is encapsulated with the node exec() function, so this cmd need to pipe stdin for avoid deadlock. cf : #10

GreenDjango commented 4 years ago

Remove spinner cursor on git clone Add in keys management menu a trust host function