process_executer 4.1.2 → 4.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 58884682b61a416e64d16dabe3f8192a129e4281d6e315c5cb676256dee9afd2
4
- data.tar.gz: 2f08fa0b9a801eebd7ae2e24699c460edab33272e89801f4c59f839196b61a24
3
+ metadata.gz: 286b5bfeeee60e4a050ca4c1ff82180a14f59fb26fc46ab2730a2e9124614858
4
+ data.tar.gz: a2744c45ba10043684e2b4af6fe090f76806c8a748f7a1f5f5fffbcce02f2444
5
5
  SHA512:
6
- metadata.gz: f5ab2e6ee671a90fba84d7531c38b9eb8928bd2f8f93948cb1a577551126aa996555566a0ca6a4fc95b5e536374638e53b2218ab4d45088c11932318b59c9085
7
- data.tar.gz: f929f097160797d721c4918f030c597943c1cad830877869416d553bc4c9c0ffedc16ce989eae9b07ae7990c2ffdec023799b10dbad356fa06fe73749a52dcc9
6
+ metadata.gz: e243b1759ce7602244529fcb21141d512bb2c00bb6823b3332c1a49a09891e765c3203459d110af3485e9b785fe2f74e02c4ea96ba1c5f194a5bf6a5a531fb4b
7
+ data.tar.gz: 3047cb10bda606a268e00eec4389056d00d988deb6671968ffab61f02475fe827d68680606b288d6d62b086ade14fa50d5395cecc734f32ca1f1776b6e43d04e
@@ -1,3 +1,3 @@
1
1
  {
2
- ".": "4.1.2"
2
+ ".": "4.1.3"
3
3
  }
data/CHANGELOG.md CHANGED
@@ -5,6 +5,20 @@ All notable changes to the process_executer gem will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [4.1.3](https://github.com/main-branch/process_executer/compare/v4.1.2...v4.1.3) (2026-11-16)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * Finish a MonitoredPipe close that was unwound before it woke the monitoring thread ([53f853e](https://github.com/main-branch/process_executer/commit/53f853ead4f31c3eaecfba08052ae9765cfe859c)), closes [#218](https://github.com/main-branch/process_executer/issues/218)
14
+
15
+
16
+ ### Other Changes
17
+
18
+ * Add the Windows hand-run scripts for the failed-spawn workarounds ([e5303d0](https://github.com/main-branch/process_executer/commit/e5303d0035e66aa05c68d35e643c89aed70ce203))
19
+ * Show that a close unwound before it wakes the monitoring thread can't be finished ([b957978](https://github.com/main-branch/process_executer/commit/b95797826cc5ef2f080c122cb307f5bde9fccec4))
20
+ * Stop the destination_failed? example failing when the pipe closes during its write ([d8a55bb](https://github.com/main-branch/process_executer/commit/d8a55bbb0f2d4e27267fc88bab0c01e265af1c43))
21
+
8
22
  ## [4.1.2](https://github.com/main-branch/process_executer/compare/v4.1.1...v4.1.2) (2026-11-15)
9
23
 
10
24
 
@@ -543,6 +543,7 @@ module ProcessExecuter
543
543
  # The wake pipe lets #close interrupt the monitoring thread, which
544
544
  # otherwise blocks in IO.select waiting for pipe data (see #monitor_pipe)
545
545
  @wake_reader, @wake_writer = IO.pipe
546
+ @woken = false
546
547
  end
547
548
 
548
549
  # Transition the state from `:open` to `:closing` and wait for `:closed`
@@ -550,7 +551,15 @@ module ProcessExecuter
550
551
  # Implements the state-changing half of {#close}: under the mutex, record
551
552
  # the close deadline, set the state to `:closing`, wake the monitoring
552
553
  # thread, and wait for it to signal that the state reached `:closed`. A
553
- # pipe that is not `:open` (already closing or closed) is left alone.
554
+ # pipe that is already `:closed` is left alone.
555
+ #
556
+ # A pipe found `:closing` was left that way by a close that has not
557
+ # finished: one still in progress on another thread, or one unwound by an
558
+ # exception raised into its caller, as a signal handler that raises can
559
+ # do. The second kind may have been unwound before it woke the monitoring
560
+ # thread, which would then sleep until the pipe reached end-of-file. So
561
+ # the wake is sent if it has not been, and {#close} goes on to join the
562
+ # thread. The deadline the first close set still applies.
554
563
  #
555
564
  # @param timeout [Numeric, nil] seconds to spend draining remaining pipe
556
565
  # data (see {#close}), or `nil` for no time limit
@@ -558,24 +567,38 @@ module ProcessExecuter
558
567
  # @api private
559
568
  def initiate_close_and_wait_until_closed(timeout)
560
569
  mutex.synchronize do
570
+ wake_monitoring_thread if state == :closing
561
571
  break unless state == :open
562
572
 
563
573
  @close_deadline = timeout ? Process.clock_gettime(Process::CLOCK_MONOTONIC) + timeout : nil
564
574
  @state = :closing
565
-
566
- # The wake pipe is written at most once in its life: here, on the
567
- # :open -> :closing transition. It is a one-shot signal, not a reusable
568
- # channel, so the monitoring thread never needs to drain it (its loop
569
- # never continues past this wakeup). The write needs no rescue: the
570
- # monitoring thread closes the wake fds only after it publishes
571
- # `@state = :closed` under this same mutex, so while this thread holds
572
- # the mutex having observed :open, the wake fds are still open.
573
- wake_writer.write('.')
575
+ wake_monitoring_thread
574
576
 
575
577
  condition_variable.wait(mutex) while @state != :closed
576
578
  end
577
579
  end
578
580
 
581
+ # Wake the monitoring thread from its wait for pipe data, once
582
+ #
583
+ # The wake pipe is a one-shot signal, not a reusable channel, so the
584
+ # monitoring thread never needs to drain it (its loop never continues past
585
+ # this wakeup). The flag is set after the write: a caller unwound between
586
+ # the two writes a second byte the next time, which nothing reads.
587
+ #
588
+ # Call with the mutex held and the state `:closing`. The write then needs
589
+ # no rescue: the monitoring thread closes the wake fds only after it
590
+ # publishes `@state = :closed` under the same mutex, so they are still
591
+ # open.
592
+ #
593
+ # @return [void]
594
+ # @api private
595
+ def wake_monitoring_thread
596
+ return if @woken
597
+
598
+ wake_writer.write('.')
599
+ @woken = true
600
+ end
601
+
579
602
  # Raise an error if the destination is not compatible with MonitoredPipe
580
603
  # @return [void]
581
604
  # @raise [ArgumentError] if the destination is not compatible with MonitoredPipe
@@ -3,5 +3,5 @@
3
3
  module ProcessExecuter
4
4
  # The current Gem version
5
5
  # @return [String]
6
- VERSION = '4.1.2'
6
+ VERSION = '4.1.3'
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: process_executer
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.2
4
+ version: 4.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Couball
@@ -296,8 +296,8 @@ metadata:
296
296
  allowed_push_host: https://rubygems.org
297
297
  homepage_uri: https://github.com/main-branch/process_executer
298
298
  source_code_uri: https://github.com/main-branch/process_executer
299
- documentation_uri: https://rubydoc.info/gems/process_executer/4.1.2
300
- changelog_uri: https://rubydoc.info/gems/process_executer/4.1.2/file/CHANGELOG.md
299
+ documentation_uri: https://rubydoc.info/gems/process_executer/4.1.3
300
+ changelog_uri: https://rubydoc.info/gems/process_executer/4.1.3/file/CHANGELOG.md
301
301
  rubygems_mfa_required: 'true'
302
302
  rdoc_options: []
303
303
  require_paths: