Skip to content

Commit

Permalink
Soft deprecate Runner::Command{,Runner}
Browse files Browse the repository at this point in the history
  • Loading branch information
adamruzicka authored and ezr-ondrej committed Mar 29, 2022
1 parent 420cb2a commit ae637de
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
13 changes: 13 additions & 0 deletions lib/smart_proxy_dynflow/runner/command.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
module Proxy::Dynflow
module Runner
# This module expects to be included into a Runner action, where it can be
# used to simplify handling of long-running processes. However it tracks the
# running process as a group of instance variables, which has served us
# reasonably well in the past, but can be rather error prone.
#
# A better alternative to this is
# {::Proxy::Dynflow::Runner::ProcessManagerCommand}. It tracks the whole
# execution of a process under a single instance variable and uses a more
# robust {::Proxy::Dynflow::ProcessManager} under the hood. It also
# maintains the same interface and can be used as a drop-in replacement.
#
# This module is now soft-deprecated and
# {::Proxy::Dynflow::Runner::ProcessManagerCommand} should be used instead.
module Command
def initialize_command(*command)
@command_out, @command_in, @command_pid = PTY.spawn(*command)
Expand Down
1 change: 1 addition & 0 deletions lib/smart_proxy_dynflow/runner/command_runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

module Proxy::Dynflow
module Runner
# This class is now soft-deprecated, see {::Proxy::Dynflow::Runner::Command}
class CommandRunner < Base
include Command
end
Expand Down
6 changes: 6 additions & 0 deletions lib/smart_proxy_dynflow/runner/process_manager_command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

module Proxy::Dynflow
module Runner
# A convenience module which should be included into a Runner action. It
# leverages {::Proxy::Dynflow::ProcessManager} to reliably keep track of
# an external process and collect its output.
#
# The only expectation from the Runner action is to call
# {#initialize_command} somewhere and pass the command to be run to it.
module ProcessManagerCommand
def initialize_command(*command)
@process_manager = ProcessManager.new(command)
Expand Down

0 comments on commit ae637de

Please sign in to comment.