From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 2FF926EC58; Sat, 20 Feb 2021 14:27:28 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 2FF926EC58 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1613820448; bh=rcVUu9Zq3j0yiBjqxt9TcdRradVhCJQvVjyVCKysVI0=; h=To:References:Date:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=Ru3int39eRPwgw78W9jvOsU0UNxsQ3qqDLeeXkYYtw3+XiStIkry3xbeVq4xBY2nM lWekGnQBxpdxu5mBsYvMM6Uuk3HxOi4cVGrRObSvJTI8IktufQNg+oVexrMPzL9hXs 9MgO+OiAI1sw6xvVWoSOYZpOzAHn48r1fB4gBb5o= Received: from smtp58.i.mail.ru (smtp58.i.mail.ru [217.69.128.38]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id E69EE6EC58 for ; Sat, 20 Feb 2021 14:27:26 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org E69EE6EC58 Received: by smtp58.i.mail.ru with esmtpa (envelope-from ) id 1lDQQ1-00047h-Kr; Sat, 20 Feb 2021 14:27:26 +0300 To: Sergey Bronnikov , Alexander Turenko References: <612d38a3f3349c1c8cb6d3f549fd85720b7a1a23.1613674486.git.artemreyt@tarantool.org> Message-ID: <7be00375-3b9b-5779-a458-e541168c7eb8@tarantool.org> Date: Sat, 20 Feb 2021 14:27:25 +0300 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: ru X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD975C3EC174F56692243410BA6471F01668A37AB103014B813182A05F5380850402667607A1E7A563F49C6CB7809BD20A66A89B6B6F716706573B8F7C72700E9C9 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE721B3E54BB37EA0B4EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F790063779089FB2CE4EA2908638F802B75D45FF5571747095F342E8C7A0BC55FA0FE5FC051190C899382BF8DD6CEDF14F3F179306C668BD1F5213CB389733CBF5DBD5E913377AFFFEAFD269176DF2183F8FC7C07E7E81EEA8A9722B8941B15DA834481FCF19DD082D7633A0EF3E4896CB9E6436389733CBF5DBD5E9D5E8D9A59859A8B6D082881546D93491CC7F00164DA146DA6F5DAA56C3B73B237318B6A418E8EAB8D32BA5DBAC0009BE9E8FC8737B5C2249EBCE538409B2BEE576E601842F6C81A12EF20D2F80756B5F7E9C4E3C761E06A776E601842F6C81A127C277FBC8AE2E8BFB5E6295D600E6B73AA81AA40904B5D9DBF02ECDB25306B2B25CBF701D1BE8734AD6D5ED66289B5278DA827A17800CE77DCDFB3399A2F72893EC92FD9297F6715571747095F342E857739F23D657EF2BD5E8D9A59859A8B686502E30F3431674089D37D7C0E48F6C5571747095F342E857739F23D657EF2B6825BDBE14D8E7028C9DFF55498CEFB0BD9CCCA9EDD067B1EDA766A37F9254B7 X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A2BBE337FB72E92315FF39D8DB89857825EFA8BF88FCBFD63CE0852D54D1EC518136369562A7169B9A4F07EECBCF1A7E7E X-C1DE0DAB: 0D63561A33F958A5573E0873E3FB70422BE20576084B718A93765D8603B576DFD59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA75448CF9D3A7B2C848410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D3494FB0335DF05DC3AEC6B78785C992A9D6B51776A4F5F97E12117695C9C511CEF1A897CCE71FF85721D7E09C32AA3244C96EF7F3119607C259C52CE14640127493A76366E8A9DE7CA927AC6DF5659F194 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2bioj2CfMKaWP9xt9L6pih+oTBA== X-Mailru-Sender: 65CD03CFE33A0EC7E4F6C6702325C427C9FB6F0A62D205F0968529DE1ED09CC641E7270E77DE2C74B08A37556DE0CB7BB7E364AFDB3F206FD953F29DB7D76D89B1E6F68DAE724AB9112434F685709FCF0DA7A0AF5A3A8387 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCHv2 2/2] lua: fix tarantool -e always enters interactive mode X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Artem via Tarantool-patches Reply-To: Artem Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Thanks for the review! >> diff --git a/src/lib/core/errinj.h b/src/lib/core/errinj.h >> index d76aedf7a..d5fdbc209 100644 >> --- a/src/lib/core/errinj.h >> +++ b/src/lib/core/errinj.h >> @@ -149,6 +149,7 @@ struct errinj { >>       _(ERRINJ_AUTO_UPGRADE, ERRINJ_BOOL, {.bparam = false})\ >>       _(ERRINJ_COIO_WRITE_CHUNK, ERRINJ_BOOL, {.bparam = false}) \ >>       _(ERRINJ_APPLIER_SLOW_ACK, ERRINJ_BOOL, {.bparam = false}) \ >> +    _(ERRINJ_STDIN_ISATTY, ERRINJ_INT, {.iparam = -1}) \ > > 1. according to name (ISATTY) variable can be in enabled or disabled > state so > > why do you use integer type here? 1. I use integer type for ISATTY cause this injection "overrides" return value of standard isatty function for stdin. It can be set to 0 or 1. Default value -1 means to use return value of standard function. >>     ENUM0(errinj_id, ERRINJ_LIST); >>   extern struct errinj errinjs[]; >> diff --git a/src/lua/init.c b/src/lua/init.c >> index 25e8884a6..e7e0fe006 100644 >> --- a/src/lua/init.c >> +++ b/src/lua/init.c >> @@ -62,6 +62,7 @@ >>   #include "lua/swim.h" >>   #include "lua/decimal.h" >>   #include "digest.h" >> +#include "errinj.h" >>   #include >>     #include >> @@ -583,6 +584,7 @@ run_script_f(va_list ap) >>        */ >>       struct diag *diag = va_arg(ap, struct diag *); >>       bool aux_loop_is_run = false; >> +    bool option_e_runned = false; >>         /* >>        * Load libraries and execute chunks passed by -l and -e >> @@ -613,6 +615,7 @@ run_script_f(va_list ap) >>               if (luaT_call(L, 0, 0) != 0) >>                   goto error; >>               lua_settop(L, 0); >> +            option_e_runned = true; >>               break; >>           default: >>               unreachable(); /* checked by getopt() in main() */ >> @@ -627,25 +630,34 @@ run_script_f(va_list ap) >>       fiber_sleep(0.0); >>       aux_loop_is_run = true; >>   +    int is_atty; > > 2. is_a_tty? > 2. Done.