Skip to content

Commit

Permalink
Continue even if Process.setpgrp fails
Browse files Browse the repository at this point in the history
In CircleCI, calling Process.setpgrp raises an "Operation not permitted" error,
but other than that flatware works.

In this change, we allow flatware to continue when the error is raised.

If flatware is executed with --log, then it will print:
INFO -- : flatware sink continuing after: Process.setpgrp: Operation not permitted

At Carwow, we have been running flatware on CircleCI for about 1 month
(with a monkey-patched Process.setpgrp) and it works great!

It allowed Carwow to reduce CircleCI credits by half, and also our Docker Hub pulls.
  • Loading branch information
PChambino committed Mar 1, 2024
1 parent ed0a352 commit 8dd0d5a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/flatware/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ def clear

def start_sink(jobs:, workers:, formatter:)
$0 = 'flatware sink'
Process.setpgrp
try_setpgrp

passed = Sink.start_server(
jobs: jobs,
formatter: Flatware::Broadcaster.new([formatter]),
Expand All @@ -65,6 +66,12 @@ def start_sink(jobs:, workers:, formatter:)
exit passed ? 0 : 1
end

def try_setpgrp
Process.setpgrp
rescue Errno::EPERM => e
Flatware.log 'continuing after: Process.setpgrp:', e.message
end

def workers
options[:workers]
end
Expand Down

0 comments on commit 8dd0d5a

Please sign in to comment.