lean4-htt/leanpkg/leanpkg/proc.lean
Leonardo de Moura dc1a1c8540 refactor(library): has_to_string ==> has_repr
See issue #1664

This is just the first step to implement proposal described at issue #1664.
2017-06-18 18:29:19 -07:00

24 lines
621 B
Text

/-
Copyright (c) 2017 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Author: Gabriel Ebner
-/
import system.io leanpkg.toml
open io io.proc
variable [io.interface]
namespace leanpkg
def exec_cmd (args : io.process.spawn_args) : io unit := do
let cmdstr := join " " (args.cmd :: args.args),
io.put_str_ln $ "> " ++
match args.cwd with
| some cwd := cmdstr ++ " # in directory " ++ cwd
| none := cmdstr
end,
ch ← spawn args,
exitv ← wait ch,
when (exitv ≠ 0) $ io.fail $
"external command exited with status " ++ repr exitv
end leanpkg