Closed LeifW closed 9 years ago
Hey,
I use ghc 6.12.3 Ubuntu 11.04 and I have little issue here. I would like to have a function which take some shell commands and execute them as the superuser (like sudo update-manager, sudo iwlist ....) in Haskell. I know that the System.Process module have some functions like createProcess, runInteractiveCommand. But there are for a single raw command or a single shell command, not for compound commnads like "sudo update-manager". All my experiments on those functions to execute "sudo ..." failed. The terminal I used to run my haskell function had no response. I also looked at HSH package. But it seems to me that functions exported there are not good for sudo commands either. My guess is that executing commands like "sudo update-manager" requires two process. One is for "sudo" and the other one is for "update-manager". So I need to call functions like "createProcess" twice and somehow connect them so that the second process for "update-manager" get superuser privilege from the first process for "sudo".
Thanks in advance for help!
@LeifW sounds proper. I left it in there when it was PR'd because I figured maybe not all Arch users had sudo installed or something weird like that.
Thanks for the PR!
It said sudo
before, but also included an unnecessary -Syy
line, and someone fixed that, and also changed the sudo
to su -c
. Maybe that person doesn't use sudo, but that seems to be a rarity. ¯(ツ)/¯
Can't recall seeing su -c
used instead of sudo
on any docs, e.g. https://wiki.archlinux.org/index.php/Pacman_tips
@LeifW just as well then. Thanks for the PR :) :bear: :hamster:
I believe most people use sudo for this sort of thing, rather than su + root password.