From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS22989 208.118.235.0/24 X-Spam-Status: No, score=-1.9 required=3.0 tests=AWL,BAYES_00 shortcircuit=no autolearn=unavailable version=3.3.2 X-Original-To: dtas-all@80x24.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 780531F459 for ; Sat, 17 Jan 2015 11:49:41 +0000 (UTC) Received: from localhost ([::1]:58904 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YCRsq-0003Hj-VY for dtas-all@80x24.org; Sat, 17 Jan 2015 06:49:40 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43195) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YCRso-0003H8-4O for dtas-all@nongnu.org; Sat, 17 Jan 2015 06:49:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YCRsn-0006rI-6D for dtas-all@nongnu.org; Sat, 17 Jan 2015 06:49:38 -0500 Received: from dcvr.yhbt.net ([64.71.152.64]:45033) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YCRsn-0006q2-0i for dtas-all@nongnu.org; Sat, 17 Jan 2015 06:49:37 -0500 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 065FE1F45A; Sat, 17 Jan 2015 11:49:30 +0000 (UTC) From: Eric Wong To: Subject: [PATCH 4/5] dtas-console: avoid crashing on failed cue seeks Date: Sat, 17 Jan 2015 11:49:21 +0000 Message-Id: <1421495362-31430-5-git-send-email-e@80x24.org> X-Mailer: git-send-email 2.3.0.rc0.45.ga7910d6 In-Reply-To: <1421495362-31430-1-git-send-email-e@80x24.org> References: <1421495362-31430-1-git-send-email-e@80x24.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 64.71.152.64 Cc: e@80x24.org X-BeenThere: dtas-all@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dtas-all-bounces+dtas-all=80x24.org@nongnu.org Sender: dtas-all-bounces+dtas-all=80x24.org@nongnu.org Attempting to perform operations on a file which which cannot handle it should not cause dtas-console to die with a backtrace --- bin/dtas-console | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bin/dtas-console b/bin/dtas-console index ee0c126..2ed2f0b 100755 --- a/bin/dtas-console +++ b/bin/dtas-console @@ -104,6 +104,10 @@ def rg_string(rg, current) rv end +def may_fail(res, events) + events << res if res != "OK" +end + enc_locale = Encoding.find("locale") $stdout.set_encoding(enc_locale) enc_opts = { undef: :replace, invalid: :replace, replace: '?' } @@ -202,8 +206,8 @@ begin when "f" then c.req_ok("rg fallback_gain-=1") when ">" then c.req_ok("tl next") when "<" then c.req_ok("tl prev") - when "!" then c.req_ok("cue prev") - when "@" then c.req_ok("cue next") + when "!" then may_fail(c.req("cue prev"), events) + when "@" then may_fail(c.req("cue next"), events) when " " c.req("play_pause") when "r" # cycle through replaygain modes -- EW