* [PATCH 0/3] fixup annoying Ruby 2.7.0dev warnings
@ 2019-10-31 10:00 Eric Wong
2019-10-31 10:00 ` [PATCH 1/3] dtas-console: remove unused variables Eric Wong
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Eric Wong @ 2019-10-31 10:00 UTC (permalink / raw)
To: dtas-all
Testing Ruby 2.7.0dev reveals more annoying warnings, which
end users (not hackers) would suffer from :<
*sigh*
Eric Wong (3):
dtas-console: remove unused variables
dtas-console: pass kwargs as-is to String#encode
buffer/splice: pass kwargs as-is to tee/splice
bin/dtas-console | 11 +++--------
lib/dtas/buffer/splice.rb | 10 ++++++----
2 files changed, 9 insertions(+), 12 deletions(-)
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/3] dtas-console: remove unused variables
2019-10-31 10:00 [PATCH 0/3] fixup annoying Ruby 2.7.0dev warnings Eric Wong
@ 2019-10-31 10:00 ` Eric Wong
2019-10-31 10:00 ` [PATCH 2/3] dtas-console: pass kwargs as-is to String#encode Eric Wong
2019-10-31 10:00 ` [PATCH 3/3] buffer/splice: pass kwargs as-is to tee/splice Eric Wong
2 siblings, 0 replies; 4+ messages in thread
From: Eric Wong @ 2019-10-31 10:00 UTC (permalink / raw)
To: dtas-all
"ruby -w" will warn on them
---
bin/dtas-console | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/bin/dtas-console b/bin/dtas-console
index 00b5cd8..877c9c4 100755
--- a/bin/dtas-console
+++ b/bin/dtas-console
@@ -53,8 +53,6 @@ def update_tfmt(prec, tsec)
events = []
interval = 1.0 / 10 ** prec_nr
-pause = nil
-
def show_events(lineno, screen, events)
Curses.setpos(lineno += 1, 0)
Curses.clrtoeol
@@ -135,7 +133,6 @@ def may_fail(res, events)
pfmt = cur['format']
elapsed = samples = 0
fmt = total = ''
- paused = false
if current = cur['current']
infile = current['infile'] || current['command']
elapsed = DTAS.now - current['spawn_at']
@@ -150,7 +147,6 @@ def may_fail(res, events)
end
elsif cur['paused'] && infile = cur['current_paused']
fmt = "[paused] (#{fmt_to_s(pfmt)})"
- paused = true
infile = infile['command'] if Hash === infile
if Array === infile
infile, elapsed = infile
@@ -220,10 +216,9 @@ def may_fail(res, events)
case event
when "pause"
if current
- pause = current['infile'] || current['command']
+ current['infile'] || current['command']
end
when %r{\Afile }
- pause = nil
end
events << "#{Time.now.strftime(tfmt)} #{event}"
# something happened, refresh current
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/3] dtas-console: pass kwargs as-is to String#encode
2019-10-31 10:00 [PATCH 0/3] fixup annoying Ruby 2.7.0dev warnings Eric Wong
2019-10-31 10:00 ` [PATCH 1/3] dtas-console: remove unused variables Eric Wong
@ 2019-10-31 10:00 ` Eric Wong
2019-10-31 10:00 ` [PATCH 3/3] buffer/splice: pass kwargs as-is to tee/splice Eric Wong
2 siblings, 0 replies; 4+ messages in thread
From: Eric Wong @ 2019-10-31 10:00 UTC (permalink / raw)
To: dtas-all
Ruby 2.7.0dev will warn when hashes are passed and intended
for use as kwargs unless we expand the hash via "**enc_opts",
but "**" is Ruby 2.0+ syntax and I guess we still support
1.9.3 for the time being.
---
bin/dtas-console | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/bin/dtas-console b/bin/dtas-console
index 877c9c4..2143e65 100755
--- a/bin/dtas-console
+++ b/bin/dtas-console
@@ -119,7 +119,6 @@ def may_fail(res, events)
pre_mute_vol = 1.0
enc_locale = Encoding.find("locale")
$stdout.set_encoding(enc_locale)
-enc_opts = { undef: :replace, invalid: :replace, replace: '?' }
begin
Curses.init_screen
Curses.nonl
@@ -165,7 +164,8 @@ def may_fail(res, events)
# FS encoding != locale encoding, but we need to display an FS path
# name to whatever locale the terminal is encoded to, so force it
# and risk mojibake...
- infile.encode(enc_locale, enc_opts)
+ infile.encode(enc_locale,
+ undef: :replace, invalid: :replace, replace: '?')
Curses.setpos(lineno += 1, 0)
Curses.clrtoeol
Curses.addstr(infile)
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 3/3] buffer/splice: pass kwargs as-is to tee/splice
2019-10-31 10:00 [PATCH 0/3] fixup annoying Ruby 2.7.0dev warnings Eric Wong
2019-10-31 10:00 ` [PATCH 1/3] dtas-console: remove unused variables Eric Wong
2019-10-31 10:00 ` [PATCH 2/3] dtas-console: pass kwargs as-is to String#encode Eric Wong
@ 2019-10-31 10:00 ` Eric Wong
2 siblings, 0 replies; 4+ messages in thread
From: Eric Wong @ 2019-10-31 10:00 UTC (permalink / raw)
To: dtas-all
Ruby 2.7.0dev will warn when hashes are passed and intended
for use as kwargs unless we expand the hash via "**TRY",
but "**" is Ruby 2.0+ syntax and I guess we still support
1.9.3 for the time being.
---
lib/dtas/buffer/splice.rb | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/lib/dtas/buffer/splice.rb b/lib/dtas/buffer/splice.rb
index 281ecfd..2e86d0a 100644
--- a/lib/dtas/buffer/splice.rb
+++ b/lib/dtas/buffer/splice.rb
@@ -12,7 +12,6 @@ module DTAS::Buffer::Splice # :nodoc:
MAX_AT_ONCE_1 = 65536
F_MOVE = SleepyPenguin::F_MOVE
F_NONBLOCK = SleepyPenguin::F_NONBLOCK
- TRY = { exception: false }.freeze
def buffer_size
@to_io.pipe_size
@@ -32,7 +31,8 @@ def discard(bytes)
def broadcast_one(targets, limit = nil)
# single output is always non-blocking
limit ||= MAX_AT_ONCE_1
- s = SleepyPenguin.splice(@to_io, targets[0], limit, F_MOVE|F_NONBLOCK, TRY)
+ s = SleepyPenguin.splice(@to_io, targets[0], limit, F_MOVE|F_NONBLOCK,
+ exception: false)
if Symbol === s
targets # our one and only target blocked on write
else
@@ -71,7 +71,8 @@ def __broadcast_tee(blocked, targets, chunk_size)
targets.delete_if do |dst|
begin
t = (dst.nonblock? || most_teed == 0) ?
- SleepyPenguin.tee(@to_io, dst, chunk_size, F_NONBLOCK, TRY) :
+ SleepyPenguin.tee(@to_io, dst, chunk_size, F_NONBLOCK,
+ exception: false) :
__tee_in_full(@to_io, dst, chunk_size)
if Integer === t
if t > most_teed
@@ -119,7 +120,8 @@ def broadcast_inf(targets, limit = nil)
begin
targets << last
if last.nonblock? || most_teed == 0
- s = SleepyPenguin.splice(@to_io, last, bytes, F_MOVE|F_NONBLOCK, TRY)
+ s = SleepyPenguin.splice(@to_io, last, bytes, F_MOVE|F_NONBLOCK,
+ exception: false)
if Symbol === s
blocked << last
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-10-31 10:06 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-31 10:00 [PATCH 0/3] fixup annoying Ruby 2.7.0dev warnings Eric Wong
2019-10-31 10:00 ` [PATCH 1/3] dtas-console: remove unused variables Eric Wong
2019-10-31 10:00 ` [PATCH 2/3] dtas-console: pass kwargs as-is to String#encode Eric Wong
2019-10-31 10:00 ` [PATCH 3/3] buffer/splice: pass kwargs as-is to tee/splice Eric Wong
Code repositories for project(s) associated with this public inbox
https://80x24.org/dtas.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).