New Ticket     Wiki     Browse Source     Timeline     Roadmap     Ticket Reports     Search

Ticket #18304: patch-portbuild.tcl.diff

File patch-portbuild.tcl.diff, 1.3 KB (added by perry@…, 2 years ago)
  • portbuild.tcl

     
    104104} 
    105105 
    106106proc portbuild::build_getnicevalue {args} { 
    107     if {![exists build.nice] || [string match "* *" [option build.cmd]]} { 
     107    if {![exists build.nice]} { 
    108108        return "" 
    109109    } 
    110110    set nice [option build.nice] 
     
    165165    set jobs_suffix [build_getjobsarg] 
    166166 
    167167    set realcmd ${build.cmd} 
    168     set build.cmd "$nice_prefix${build.cmd}$jobs_suffix" 
     168    set build.cmd [list] 
     169 
     170    # If build.cmd can be a series of commands, we need to iterate through the 
     171    # list and apply nice to commands that are not shell built-in commands. 
     172    set add_nice_prefix 1 
     173    foreach word [split [join $realcmd]] { 
     174        # Only the first word in build.cmd and words that follow the control 
     175        # operators && and || should be commands. 
     176        if {$add_nice_prefix && ![catch {findBinary $word} result]} { 
     177            lappend build.cmd "$nice_prefix$word" 
     178        } else { 
     179            lappend build.cmd $word 
     180        } 
     181        set add_nice_prefix 0 
     182 
     183        if {$word eq "&&" || $word eq "||"} { 
     184            set add_nice_prefix 1 
     185        } 
     186    } 
     187    set build.cmd "[join ${build.cmd}]$jobs_suffix" 
     188 
    169189    command_exec build 
    170190    set build.cmd ${realcmd} 
    171191    return 0