From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-f195.google.com (mail-lj1-f195.google.com [209.85.208.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 071F64696C3 for ; Sun, 12 Apr 2020 13:37:24 +0300 (MSK) Received: by mail-lj1-f195.google.com with SMTP id q17so2468178ljm.6 for ; Sun, 12 Apr 2020 03:37:24 -0700 (PDT) Date: Sun, 12 Apr 2020 13:37:21 +0300 From: Cyrill Gorcunov Message-ID: <20200412103721.GV3072@uranus> References: <20200411231034.95903-1-roman.habibov@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200411231034.95903-1-roman.habibov@tarantool.org> Subject: Re: [Tarantool-patches] [PATCH] console: check on_shutdown() before exit List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Roman Khabibov Cc: tarantool-patches@dev.tarantool.org On Sun, Apr 12, 2020 at 02:10:34AM +0300, Roman Khabibov wrote: > Add check that on_shutdown() triggers were called before exit, > because in case of EOF or Ctrl+D (no signals) they were ignored. > > Closes #4703 Ok, I don't see any obvious problems with the patch. Only a nit due to coding style below. ... > diff --git a/test/box/on_shutdown.test.lua b/test/box/on_shutdown.test.lua > index 2a9143404..795887202 100644 > --- a/test/box/on_shutdown.test.lua > +++ b/test/box/on_shutdown.test.lua > @@ -65,3 +65,20 @@ test_run:grep_log('test', 'signal', nil, {noreset=true}) ... > +on_shutdown_cmd = "box.ctl.on_shutdown(function() local fio = require('fio') ".. > + "fio.open('"..file_name.."', {'O_CREAT', 'O_TRUNC', 'O_WRONLY'}, 777):clo".. > + "se() end)"; This is ugly as hell. Can we please do not split "close". Something like on_shutdown_cmd = "box.ctl.on_shutdown(function() local fio = require('fio') ".. "fio.open('"..file_name.."', ".. "{'O_CREAT', 'O_TRUNC', 'O_WRONLY'}, 777):close() end)"; Or somehow more readable? Maybe like on_shutdown_cmd = "box.ctl.on_shutdown(function() local fio = require('fio') ".. "local flags = {'O_CREAT', 'O_TRUNC', 'O_WRONLY'}" .. "local f = fio.open(mode, 777)" .. "f:close()" (I'm sure I've done some typos here but you get the idea)