"Jim - FooBar();" <jimpil1...@gmail.com> writes:

> ---------------------------------------------------------------------------------------------------------------------------------
> (defn shutdown-pc [root-pwd minutes-after]
> (let [op-system  (System/getProperty "os.name")
>       enviroment (Runtime/getRuntime)]
> (cond
>     (or (.startsWith op-system "Linux")
>         (.startsWith op-system "Mac OS"))
>              (.exec enviroment (str "echo " root-pwd " |" " sudo -S 
> shutdown -h +" minutes-after))
>         (.startsWith op-system "Windows")
>              (.exec enviroment (str "shutdown -s -t " minutes-after))
>     :else (throw (RuntimeException. "Unsupported operating system!"))))
> ----------------------------------------------------------------------------------------------------------------------------------

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.


-- 
Craig Brozefsky <cr...@red-bean.com>
Premature reification is the root of all evil

-- 
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