Hi!

I am sharing my Conkeror configuration between several computers and I
would like some configuration settings to be specific to a
host. Usually, this means adding a condition the hostname.

I did not find any function that would return me the hostname. I have
nothing in the environment variables that contain the hostname and I
would like to avoid to add one.

I have tried to use `shell_command` but it uses coroutines and I didn't
find a way to execute coroutines synchronously outside of a coroutine. I
have tried this:

#v+
function hostname() {
    var output = "";
    var result = shell_command("uname -n",
                               $fds = [{ output: async_binary_string_writer("") 
},
                                       { input: async_binary_reader(function 
(s) output += s )},
                                       { input: async_binary_reader(function 
(s) null)}]);
    try {
        while (true) result.next();
    } catch (e if e instanceof StopIteration) {
        return output;
    }
};
#v-

But this does not work. I get an empty string.

Any idea?
--
Make sure your code "does nothing" gracefully.
            - The Elements of Programming Style (Kernighan & Plauger)
_______________________________________________
Conkeror mailing list
Conkeror@mozdev.org
https://www.mozdev.org/mailman/listinfo/conkeror

Reply via email to