Boost logo

Boost-Build :

Subject: Re: [Boost-build] new EXEC builtin command
From: Nogradi, Chris (Chris.Nogradi_at_[hidden])
Date: 2012-02-20 08:24:37


>From a user's perspective, what would be the difference between the SHELL and EXEC commands? What purpose would there be to use one over the other on anything other than windows?

Chris

-----Original Message-----
From: boost-build-bounces_at_[hidden] [mailto:boost-build-bounces_at_[hidden]] On Behalf Of Marc Dürner
Sent: Friday, February 17, 2012 2:49 AM
To: boost-build_at_[hidden]
Subject: [Boost-build] new EXEC builtin command

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;
    exec_closure ec;

    command = lol_get( frame->args, 0 );
    if( ! command )
        return L0;

    varname = object_new( "JAMSHELL" );
    shell = var_get( varname );
    object_free( varname );

    exec_cmd( object_str( command->value ), exec_callback, &ec, shell, 0, 0);
    exec_wait();

    /* ec.result is a LIST* */
    return ec.result;
}

Can we add such a builtin rule to bjam, or change the SHELL rule? It
works well on windows, linux and OS-X.

best regards,
Marc
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build

This e-mail and any attachments may contain confidential material for the sole use of the intended recipient. If you are not the intended recipient, please be aware that any disclosure, copying, distribution or use of this e-mail or any attachment is prohibited. If you have received this e-mail in error, please contact the sender and delete all copies.

Thank you for your cooperation.


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