Raku / ake

A Raku make-a-like inspired by rake
Artistic License 2.0
12 stars 10 forks source link

Using run in (non-)sink context #12

Closed AlexDaniel closed 5 years ago

AlexDaniel commented 7 years ago

Let's say we have these tasks:

task ‘run’, {
    run ‘false’; # FAIL!!!
}

task ‘finish’ => ‘run’, {
    say ‘finish’
}

Try sake finish. Some would argue that using run without checking the result is wrong. However, a typical makefile can have a lot of calls to other commands, and writing a check for each of them is probably an overkill given that failed procs will blow up in sink context anyway. But there is one issue which is demonstrated above. The last statement will be returned from the block, so it fails silently. It can be easily fixed by writing something like:

task ‘run’, {
    run ‘false’; # FAIL!!!
    True # ← make sure we are not sinking our proc
}

But I think that Sake can do something to prevent this trap.