Subject: [Boost-build] new EXEC builtin command
From: Marc Dürner (marc.duerner_at_[hidden])
Date: 2012-02-17 03:48:59
Hello boost builders,
I would like to suggest a new builtin rule named EXEC, or reimplement
for the SHELL builtin rule.
I have tried to use the current SHELL rule with mixed success. It
seems it does not work well under windows when paths have spaces and
the command needs to be qouted. The reason for this is a limited
implementation of popen on windows.
I have also observed that there is already code in jam that performs
execution of shell commands, the execcmd API. So it should be possible
to build the SHELL builtin rule on top of exec_cmd() and exec_wait().
Something like this:
static void exec_callback(void *closure, int status, timing_info*
time, const char* cmd, const char* output)
exec_closure* ec = (closure*) closure;
LIST* list = ec.result;
/* move buffer into jam variables */
LIST *builtin_exec( FRAME * frame, int flags)
LIST* command = 0;
OBJECT* varname = 0;
LIST* shell = 0;
command = lol_get( frame->args, 0 );
if( ! command )
varname = object_new( "JAMSHELL" );
shell = var_get( varname );
object_free( varname );
exec_cmd( object_str( command->value ), exec_callback, &ec, shell, 0, 0);
/* ec.result is a LIST* */
Can we add such a builtin rule to bjam, or change the SHELL rule? It
works well on windows, linux and OS-X.
Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk