On 07/05/12 16:16, Craig Brozefsky wrote:
You should checkout proces output to make sure, but I'm betting that
sudo is opening a tty to read the password and not getting it from
stdout.  The properly solution here, here, may be to define shutdown as
a sudo action for your user ID which does not require a password.

Well yeah but then only me can use it...it will not work on another machine!

On 07/05/12 16:16, Aaron Cohen wrote:
Another alternative might be to configure your /etc/sudoers to not require a password when running the shutdown command for the user that is making this call.

Same here...i want this function to work across different machines/op-systems.

I think input redirection (the "|" you have there) is a construct of your shell rather than the OS, so you have to wrap that in a call to bash or whatever shell you prefer.

How would i do that? I thought the command i need to pass in ".exec()" is simply the command i would type in my terminal (windows or unix)...and i know that the command works at least on my ubuntu...


In preference to using Runtime/exec, you can use clojure.java.shell/sh and write your password to the stdin of the process using its :in argument.

Now that sounds more sensible but it means that the consumer has to have clojure...what if i was to aot-compile the function with gen-class to pretend it is plain Java?


Jim


--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to