Changeset 13


Ignore:
Timestamp:
Nov 17, 2005, 12:57:45 AM (20 years ago)
Author:
dmik
Message:

Result code from make is now preserved when running it through a pipe

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/configure.cmd

    r12 r13  
    8585 ******************************************************************************/
    8686
     87call MagicCmdHook arg(1)
    8788call MagicLogHook arg(1)
    8889
     
    687688            call lineout build_log
    688689            address 'cmd',
    689                 'make clean 2>&1 | "'G.!ScriptFile'" --magic-log='build_log
     690                '"'G.!ScriptFile'" --magic-cmd make clean 2>&1 |',
     691                '"'G.!ScriptFile'" --magic-log 'build_log
    690692        end
    691693        else rc = 0
     
    696698            call lineout build_log
    697699            address 'cmd',
    698                 'make' build_target '2>&1 | "'G.!ScriptFile'" --magic-log='build_log
     700                '"'G.!ScriptFile'" --magic-cmd make' build_target '2>&1 |',
     701                '"'G.!ScriptFile'" --magic-log 'build_log
    699702        end
    700703        if (rc \== 0) then do
     
    12441247
    12451248/**
     1249 *  Magic cmd handler.
     1250 *  Executes the commad passed as --magic-cmd <cmd> and writes the result code
     1251 *  to the standard output in the form of 'RC:<rc>:CR'
     1252 *  (to be used by MagicLogHook).
     1253 */
     1254MagicCmdHook: procedure
     1255    parse arg magic' 'cmd
     1256    if (magic \== '--magic-cmd') then return
     1257    cmd = strip(cmd)
     1258    signal on halt name MagicCmdHalt
     1259    address 'cmd' cmd
     1260    say 'RC:'rc':CR'
     1261    exit 0
     1262
     1263MagicCmdHalt:
     1264    say 'RC:255:CR'
     1265    exit 255
     1266   
     1267/**
    12461268 *  Magic log handler.
    12471269 */
    12481270MagicLogHook: procedure
    1249     parse arg magic'='file
     1271    parse arg magic' 'file
    12501272    if (magic \== '--magic-log') then return
    1251     file = strip(file, 'T')
     1273    file = strip(file)
    12521274    signal on halt name MagicLogHalt
     1275    rc = 0 
    12531276    do while (stream('STDIN', 'S') == 'READY')
    12541277        line = linein()
     1278        if (left(line, 3) == 'RC:') then do
     1279            if (right(line,3) == ':CR') then do
     1280                rc = substr(line, 4, length(line) - 6)
     1281                iterate
     1282            end
     1283        end
    12551284        call lineout, line
    12561285        call lineout file, line
    12571286    end
    1258     exit 0
     1287    exit rc
    12591288
    12601289MagicLogHalt:
Note: See TracChangeset for help on using the changeset viewer.