gerardog/gsudo

Issue: Running vim using sudo hangs.

sebthom opened this issue · 2 comments

Issue Description

I am trying to run vim with sudo but the process hangs.

Steps to Reproduce

  1. Install scoop
  2. Install gsudo and git-with-openssh via scoop
  3. Try to execute vim via sudo, e.g.
    > C:\scoop\shims\sudo.exe C:\scoop\shims\apps\git-with-openssh\current\usr\bin\vim.exe
    
    This results in a blank command window that does not react to any keyboard interaction. Aborting using CTRL+C is ignored.

The same works fine using this sudo implementation: https://github.com/chrisant996/sudo-windows/

Screenshots

image

Context:

  • Windows version: Microsoft Windows [Version 10.0.19045.2728] 22H2 - English
  • gsudo version: gsudo v2.0.6 (Branch.tags-v2.0.6.Sha.6da4723971cc95f4285797b31545ddfdd2ceca0d)

Seems to work when I use the --copyev flag for some reason.

If I gsudo vim and then kill vim.exe it will show the arrow keys as a character escape sequence, which is something I havent seen before, maybe this is a problem handling the console mode.
image

I'll investigate, but in the meantime you can workaround it by running:

gsudo config ExceptionList = "notepad.exe;powershell.exe;vim.exe;"

...that will wrap vim into cmd /c vim. That avoids the problem.

Seems to work when I use the --copyev flag for some reason.

Yes gsudo --copyev vim does cmd /c RunBatchFileWithEnvVars & vim, so the savior CMD is added.