Zulip Chat Archive

Stream: lean4

Topic: boilerplate on `lakefile`


Asei Inoue (May 04 2024 at 06:54):

I always define the following runCmd function in my lakefile. It would be tedious to write this every time, but could it be written in short with only the built-ins provided?

see https://github.com/Seasawher/lean-book/blob/main/lakefile.lean

def runCmd (cmd : String) (args : Array String) : ScriptM Bool := do
  let out  IO.Process.output {
    cmd := cmd
    args := args
  }
  let hasError := out.exitCode != 0
  if hasError then
    IO.eprint out.stderr
  return hasError

Asei Inoue (May 04 2024 at 06:56):

runCmd is useful for registering scripts in a lakefile, and I am borrowing it from yatima. (As I remember it).

Asei Inoue (May 04 2024 at 06:57):

see https://github.com/lurk-lab/yatima

Asei Inoue (May 04 2024 at 06:58):

It would be nice if there was an easy way to write bash in the lake file script.

Asei Inoue (May 04 2024 at 06:58):

Thank you for reading!


Last updated: May 02 2025 at 03:31 UTC