mirror of
https://github.com/natnat-mc/moonbuild
synced 2026-06-22 11:09:40 +02:00
v2
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
import escape from require 'moonbuild._cmd.common'
|
||||
import flatten from require 'moonbuild._common'
|
||||
import execute from require 'moonbuild.compat.execute'
|
||||
import popen from io
|
||||
import concat from table
|
||||
|
||||
cmdline = (...) ->
|
||||
concat [escape arg for arg in *flatten ...], ' '
|
||||
|
||||
cmd = (...) ->
|
||||
ok, ret, code = execute cmdline ...
|
||||
error "command #{first ...} exited with #{code} (#{ret})" unless ok
|
||||
|
||||
cmdrst = (...) ->
|
||||
fd, err = popen cmdline ...
|
||||
error err unless fd
|
||||
data = fd\read '*a'
|
||||
fd\close!
|
||||
data
|
||||
|
||||
sh = (cli) ->
|
||||
ok, ret, code = execute cli
|
||||
error "command '#{cli}' exited with #{code} (#{ret})" unless ok
|
||||
|
||||
{
|
||||
:cmd
|
||||
:cmdrst
|
||||
:sh
|
||||
}
|
||||
Reference in New Issue
Block a user