#Evasive comments
On this question the OP is evading answering if he's using Ubuntu or not. The question's comments illustrate this:
You should include the "#some gksudo related output" because on my system there are no error messages. What version of Ubuntu are you using? : WinEunuuchs2Unix
The warnings are related to the gtk theme, however, is not really important what the errors are as I just want to hide the output, not fix the warnings : angrykoala
I get warnings related to gtk theme all the time when running
gedit
which I suppress programmatically so I totally understand your annoyance at them. My point is there are no errors withwhoami
on my system which makes me concerned about your system. I triedgksudo
,gksu
andpkexec
all of them have no errors. : WinEunuuchs2Unixwhoami is just an example as well, it could be any other command, which I want to get the output, including errors : angrykoala
I understand. I'm just trying to duplicate the problem on my side. Are you using Ubuntu? In the mean time look at: askubuntu.com/questions/896935/… and: askubuntu.com/questions/505594/… as possible duplicates. : WinEunuuchs2Unix
This is for a script, so I would rather get a programmatic solution to avoid the output on any system. Instead of whoami, any command that send stderr would be valid to recreate the problem : angrykoala
#Background
##OP claims this happens on his system:
$ gksudo whoami
> #some gksudo related output
> root
##But on my Ubuntu 16.04 with a brand new terminal no such messages: rick@dell:~$ gksudo whoami root
rick@dell:~$ gksu whoami
root
rick@dell:~$ pkexec whoami
root
So either he isn't on Ubuntu 16.04, or my version of terminal is corrupted or he isn't using Ubuntu at all. Which makes helping him difficult in this case as the problem isn't reproducible.
###Can others confirm there are no warnings on Ubuntu?