omq 0.6.2 → 0.6.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: d98f48b27c695817b0e57b18fb2bab2f1a7d5ed87bed3c70d66b5eda3c06c77b
4
- data.tar.gz: 6a8473e8d082df4e154038175ac56c7b6aadbfeb2ecc52f672c377898b35e4d9
3
+ metadata.gz: 6a43ed94bf4595d9388897a74f6e642a865ec98a66c0cf64db084d6cb714705e
4
+ data.tar.gz: feb63595995ac894ea816e44f9ebf01d3bacf756cdb8c55b6f5438f00a6aab96
5
5
  SHA512:
6
- metadata.gz: 57fca38f85a1b65ce6275617aca7b88c420b59206dc41ae5d8b0d49824c45d4af723dd7d9481f191c768fdb691632df962c8d9e7b21452be32be5469910ffa78
7
- data.tar.gz: d183e5bff6e12f332126479cf3040d9666c8bf33efebd30c107198f0a9b88fd8ccd5fa58727cd1efdacea221dad05539ff7cadc019a8714a44139566ea4b3249
6
+ metadata.gz: 9bbe45d76566342849dcc59a8a334cf98c4f79b56392c0031e2491d4a0d3fb45d9ce7c0a9235c7138f2dd483b40721baa7fd9ce3d189c3230757f30a9c9e57f4
7
+ data.tar.gz: 1b7eccb931b57458c6cec4321fa3b4ee1de34314de7855aa3772affc434fb32561cf18e4365ab17ef5af6d5dbad62e24e7eba57d1e166d279a2b519fcfbfcf0f
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.6.3 — 2026-03-30
4
+
5
+ ### Fixed
6
+
7
+ - **`self << msg` in REP `-e` caused double-send** — `self << $F`
8
+ returns the socket, which `eval_expr` tried to coerce via `to_str`.
9
+ Now detected via `result.equal?(@sock)` and returned as a `SENT`
10
+ sentinel. REP skips the auto-send when the eval already sent the reply.
11
+ - **`eval_expr` called `to_str` on non-string results** — non-string,
12
+ non-array return values from `-e` now fail with a clear `NoMethodError`
13
+ on `to_str` (unchanged), but socket self-references are handled first.
14
+
3
15
  ## 0.6.2 — 2026-03-30
4
16
 
5
17
  ### Improved
@@ -396,11 +396,14 @@ module OMQ
396
396
  end
397
397
 
398
398
 
399
+ SENT = Object.new.freeze # sentinel: eval already sent the reply
400
+
399
401
  def eval_expr(parts)
400
402
  return parts unless @eval_proc
401
403
  $F = parts
402
404
  result = @sock.instance_exec(&@eval_proc)
403
405
  return nil if result.nil?
406
+ return SENT if result.equal?(@sock)
404
407
  return [result] if config.format == :marshal
405
408
  case result
406
409
  when Array then result
data/lib/omq/cli/pipe.rb CHANGED
@@ -228,7 +228,7 @@ module OMQ
228
228
  return parts unless @eval_proc
229
229
  $F = parts
230
230
  result = @sock.instance_exec(&@eval_proc)
231
- return nil if result.nil?
231
+ return nil if result.nil? || result.equal?(@sock)
232
232
  return [result] if config.format == :marshal
233
233
  case result
234
234
  when Array then result
@@ -55,8 +55,10 @@ module OMQ
55
55
  break if msg.nil?
56
56
  if config.expr
57
57
  reply = eval_expr(msg)
58
- output(reply)
59
- send_msg(reply || [""])
58
+ unless reply.equal?(SENT)
59
+ output(reply)
60
+ send_msg(reply || [""])
61
+ end
60
62
  elsif config.echo
61
63
  output(msg)
62
64
  send_msg(msg)
data/lib/omq/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OMQ
4
- VERSION = "0.6.2"
4
+ VERSION = "0.6.3"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omq
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrik Wenger