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=-2.4 required=3.0 tests=AWL,BAYES_00, RCVD_IN_DNSWL_BLOCKED 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 4432B1F8C5 for ; Wed, 24 Dec 2014 23:41:48 +0000 (UTC) Received: from localhost ([::1]:49659 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y3vYp-0007kW-Ho for dtas-all@80x24.org; Wed, 24 Dec 2014 18:41:47 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51445) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y3vYn-0007kP-Dn for dtas-all@nongnu.org; Wed, 24 Dec 2014 18:41:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y3vYi-0004yj-E6 for dtas-all@nongnu.org; Wed, 24 Dec 2014 18:41:45 -0500 Received: from dcvr.yhbt.net ([64.71.152.64]:35537) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y3vYi-0004yf-82 for dtas-all@nongnu.org; Wed, 24 Dec 2014 18:41:40 -0500 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 5628E1F8C5; Wed, 24 Dec 2014 23:41:38 +0000 (UTC) Date: Wed, 24 Dec 2014 23:41:38 +0000 From: Eric Wong To: dtas-all@nongnu.org Subject: [PATCH] restart "source ed" after env changes Message-ID: <20141224234138.GA12207@dcvr.yhbt.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 64.71.152.64 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 Merely converting the `before' source information to a hash is not enough, as the `env' sub-hash is mosified in-place and shared with the `after' hash. So use `inspect' to serialize and snapshot the env and rely on a string comparison. --- lib/dtas/player/client_handler.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/dtas/player/client_handler.rb b/lib/dtas/player/client_handler.rb index c9ae2e4..37357f7 100644 --- a/lib/dtas/player/client_handler.rb +++ b/lib/dtas/player/client_handler.rb @@ -474,7 +474,7 @@ module DTAS::Player::ClientHandler # :nodoc: when "cat" io.emit(src.to_source_cat.to_yaml) when "ed" - before = src.to_state_hash + before = src.to_state_hash.inspect sd = src.source_defaults msg.each do |kv| k, v = kv.split(/=/, 2) @@ -492,7 +492,7 @@ module DTAS::Player::ClientHandler # :nodoc: source_map_reload end end - after = src.to_state_hash + after = src.to_state_hash.inspect __current_requeue if before != after && @current.class == src.class io.emit("OK") else -- EW