purplesyringa / win-sudo

Add `sudo` command to Git Bash
MIT License
183 stars 55 forks source link

Installed but can't use in Git bash win10 #11

Closed ssghost closed 6 years ago

ssghost commented 6 years ago

I was successfully installed win-sudo in Git-bash of Win10, but then I typed any command begin with "sudo" a prompt box would pop up and notice me to "execute bash.exe", I clicked on "yes", and nothing happened after this, the cursor stayed at the next command line (which was empty) of Git bash window.

heidricha commented 6 years ago

Same for me. sudo command is accepted, win asks for elevated permissions, but nothing else happens, console freeze at this point. ctrl-c doesn't work, must stop with ctrl-z, and kill %1

chimericdream commented 6 years ago

Dang. I just came across this myself and was super excited, but I had the same issue as both of you. Here's hoping it might be an easy fix!

purplesyringa commented 6 years ago

Working on this!

purplesyringa commented 6 years ago

Does sudo echo 1 work for you? I've just installed win-sudo via curl -s https://raw.githubusercontent.com/imachug/win-sudo/master/install.sh | sh and it works for me.

There was a bug with usernames containing special characters (including space), is this the case for you?

ssghost commented 6 years ago

I've tried it again. The problem still exists. My username has no special characters.

purplesyringa commented 6 years ago

Okay, I'll add some debugging output and send you the link soon.

purplesyringa commented 6 years ago

@ssghost I've pushed to branch testing. Please do:

$ git clone https://github.com/imachug/win-sudo
$ cd win-sudo
$ git checkout testing
$ ./su

...and post the output. You should get:

going to start sudo
sudo started
checking admin
checking args
checking WSL
backend: /c/Users/Ivanq/Documents/win-sudo/sudobackend
created fifos: /tmp/.sudo.20675
created io fifos
set traps

<UAC window will be opened now>

bash: cannot set terminal process group (3140): Operation not permitted
bash: no job control in this shell

Ivanq@ASUS-PC MSYS ~/Documents/win-sudo (master) [SUDO]
$ started powershell
pid: 1924
set SIGINT trap
passed stdin
passed stdout&stderr

<type 'exit' now>

exit
got: 1
finished
cleaning
cleaning done
rawhead commented 6 years ago
./su
going to start sudo
sudo started
checking admin
checking args
checking WSL
backend: /c/Users/jfenk/win-sudo/sudobackend
created fifos: /tmp/.sudo.22528
created io fifos
set traps
started powershell
pid: 6312
set SIGINT trap
passed stdin
passed stdout&stderr

The line res=$(cat "$fifoid.finish") will cause the problem. Seems like the finish pipe never closes.

purplesyringa commented 6 years ago

So, does nothing happen when you type exit<enter>?

rawhead commented 6 years ago

No.

purplesyringa commented 6 years ago

Try Ctrl+C.

heidricha commented 6 years ago

passed stdin passed stdout&stderr exit < nothing happens, so pressed ctrl-z> [1]+ Stopped ./su

later it can be handled as a normal bash job. fg, bg, kill works.

$ kill %1 cleaning [1]+ Terminated ./su

G508031@RMM-P7000032FW MINGW64 ~/Work/win-sudo (testing) $ cleaning done

tulakalbeyo commented 6 years ago

i'm having this problem, too. on git's bash. capture

purplesyringa commented 6 years ago

Can you check if Git Bash or Powershell or Command line are running in background while sudo is hanging?

RicardoRdzG commented 6 years ago

It doesn't work for me either it just hangs and there is no output, in testing branch there is some output
./su going to start sudo sudo started checking admin checking args checking WSL backend: /c/Users/ricardo/bin/win-sudo/s/sudobackend created fifos: /tmp/.sudo.13739 created io fifos set traps started powershell pid: 27364 set SIGINT trap passed stdin passed stdout&stderr

bash is running in the background but it doesn't die even after closing the window you have to kill it from task manager or do C^z and then kill %1

RicardoRdzG commented 6 years ago

Looks like the problem is in the backend for some reason is not loading the path and can't find cat, just added /bin/ before each cat and it seems to work. Not sure it is the best solution but it works for now

purplesyringa commented 6 years ago

Looks like the problem was fixed.

ZenSurfer commented 4 years ago

still not working

coolerthenU2 commented 4 years ago

Does sudo echo 1 work for you? I've just installed win-sudo via curl -s https://raw.githubusercontent.com/imachug/win-sudo/master/install.sh | sh and it works for me.

There was a bug with usernames containing special characters (including space), is this the case for you?

i have a space in my name, how to do i fix this problem?