gum icon indicating copy to clipboard operation
gum copied to clipboard

gum spin is not working with sudo commands

Open matheustanaka opened this issue 2 years ago • 1 comments

Describe the bug I'm using ffmpeg to join a video with subtitle. When I try to run commands with "sudo", gum spin doesn't ask for sudo password and keep loading forever. If I try to run it without gum spin, it works. But I would like to use gum spin it if it's possible.

To Reproduce Steps to reproduce the behavior:

  • To reproduce the error you can run any command with sudo, but if you want to try it with ffmpeg you should download a .mp4 file with a subtitle .ass format.
$ gum spin --title "Juntando o Vídeo com a Legenda ..." -- sudo ffmpeg -i "$VIDEO" -vf ass="$SUBTITLE" content.mp4

Expected behavior gum spin ask for sudo password or stop the command

Screenshots

  • My terminal crash and I can't stop it. image

Desktop (please complete the following information):

  • OS: [Pop!OS 22.04]
  • ffmpeg: [5.1.2]

Additional context I'm open the issue as a bug, but i don't know exactly if gum spin can't handle with "sudo" commands. If gum spin can't work with it, sorry for my mistake

matheustanaka avatar Feb 15 '23 18:02 matheustanaka

Any script that requires an answer (sudo, pacman -Syu/dnf update/apt update) isn't working with spin directly. On the example they used sleep 5, i feel like the best way to use gum spin is inside a 'while' condition or as a sophisticated way to build "loading the next step" like this

#!/bin/bash 
gum spin --title "Waiting for the answer.." sleep 3 
echo "Enter your answer: "
read ANSWER
echo "nicely done $ANSWER"

Just my two cents tho, when i tried to use directly like you i had no return.

RochaLAJ avatar Apr 29 '23 15:04 RochaLAJ