Index: jhbuild/commands/base.py
===================================================================
--- jhbuild/commands/base.py	(revision 1502)
+++ jhbuild/commands/base.py	(working copy)
@@ -242,11 +242,36 @@
     """Run a command under the jhbuild environment"""
 
     name = 'run'
-    usage_args = 'program [ arguments ... ]'
+    usage_args = '[ --in-builddir module ] program [ arguments ... ]'
 
     def execute(self, config, args):
-        os.execlp(args[0], *args)
+        nargs = len(args)
+        if nargs > 2 and args[0] == '--in-builddir':
+            module_builddir = args[1]
+        elif nargs == 1 and args[0] == '--in-builddir':
+           raise FatalError(self.usage_args + 
+                            "\nOption --in-builddir requires a module name " +
+                            "as value.")
+        elif (nargs == 2 and args[0] == '--in-builddir') or nargs == 0:
+           raise FatalError(self.usage_args + 
+                            "\nYou must provide a program to run")
+        else:
+            module_builddir = None
 
+        if module_builddir:
+            module_set = jhbuild.moduleset.load(config)
+            try:
+                module_list = [module_set.modules[module_builddir]]
+            except KeyError, e:
+                raise FatalError("A module called '%s' could not be found."
+                                 % str(e))
+
+            build = jhbuild.frontends.get_buildscript(config, module_list)
+            builddir = module_list[0].get_builddir(build)
+            build.execute(args[2:], cwd=builddir)
+        else:
+            os.execlp(args[0], *args)
+
 register_command(cmd_run)
 
 
