Skip to content

Commit 617252e

Browse files
committed
fix(commands): properly return exit code from build
1 parent 172f555 commit 617252e

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/commands/build.cr

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,27 +39,31 @@ module Geode::Commands
3939
end
4040

4141
wg = WaitGroup.new
42+
status = 0
4243

4344
targets.each do |name|
4445
target = shard.targets[name]
4546
unless target.has_key? "main"
4647
error "Target '#{name}' missing field 'main'; skipping"
48+
status = 1
4749
next
4850
end
4951

5052
info "Building: #{name}"
5153

5254
wg.add
5355
spawn do
54-
build name, target["main"], target["flags"]?, dry, pipe
56+
status = build name, target["main"], target["flags"]?, dry, pipe
5557
wg.done
5658
end
5759
end
5860

5961
wg.wait
62+
63+
exit_program status
6064
end
6165

62-
private def build(name : String, main : String, flags : String?, dry : Bool, pipe : Bool) : Nil
66+
private def build(name : String, main : String, flags : String?, dry : Bool, pipe : Bool) : Int32
6367
command = ["build", "-o", (Path["bin"] / name).to_s, main]
6468
command << "--no-codegen" if dry
6569
command.concat flags.split if flags
@@ -81,6 +85,8 @@ module Geode::Commands
8185
end
8286
error "Target '#{name}' failed (#{taken})"
8387
end
88+
89+
status.exit_code
8490
end
8591
end
8692
end

0 commit comments

Comments
 (0)