[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Monotone-devel] Calling the shell from a hook

From: William Uther
Subject: [Monotone-devel] Calling the shell from a hook
Date: Fri, 17 Nov 2006 22:01:23 +1100

I'm just playing with monotone to see if I want to do some projects with it. Is there a way to get the output of a another process from within one of the lua hooks?


I use a Mac as my main machine, and it can store passwords in a 'keychain' for me - like the ssh-agent for those who are familiar with that. You can then use the shell to grab them:

% more bin/getPassword
#! /bin/sh

security find-generic-password -ga $1 2>&1 > /dev/null | sed -r -e 's/ password:

(see from-shell/ for more info)

I've been trying to stick this into my monotone get_passphrase() hook, but this is my first time with lua.

I was hoping something like this would work:

function get_passphrase(keypair_id)
    pass = execute("/Users/willu/bin/getPassword", "monotoneKey")
    print("finished executing")
    return pass

but that just prints the password on stdout before returning 0... not what I want. It seems that some other people have managed to get data into monotone hooks using temporary files, but I'd really rather not save a cleartext copy of the password to the filesystem if I can help it (although I may have to - luckily I can use a unique password here).

I thought I'd first ask if there was a simple, and secure, way to get stdout from another process in Lua.

Any thoughts?

Will            :-}

P.S. The other VCS I'm considering for this project is Mercurial. What do people here think are Monotone's main advantages, and disadvantages if you're willing to say, over Mercurial?

I've looked at Monotone before and it seems to have a healthy respect for data, which is nice. Mercurial seems to be being chosen by a number of high-profile projects at the moment though.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]