From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id E65ED6DE0E7E for ; Tue, 5 Nov 2019 12:47:32 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: 0.404 X-Spam-Level: X-Spam-Status: No, score=0.404 tagged_above=-999 required=5 tests=[AWL=-0.248, SPF_NEUTRAL=0.652] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id rJvvEzga1RqD for ; Tue, 5 Nov 2019 12:47:31 -0800 (PST) Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) by arlo.cworth.org (Postfix) with ESMTP id 4923E6DE0C3F for ; Tue, 5 Nov 2019 12:47:31 -0800 (PST) Received: from guru.guru-group.fi (localhost [IPv6:::1]) by guru.guru-group.fi (Postfix) with ESMTP id 2E7F5100199; Tue, 5 Nov 2019 22:47:27 +0200 (EET) From: Tomi Ollila To: David Bremner , notmuch@notmuchmail.org Subject: Re: python CFFI bindings integration into notmuch build/test In-Reply-To: <20191104013927.17037-1-david@tethera.net> References: <20191104013927.17037-1-david@tethera.net> User-Agent: Notmuch/0.28.3+84~g41389bb (https://notmuchmail.org) Emacs/25.2.1 (x86_64-unknown-linux-gnu) X-Face: HhBM'cA~ MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Nov 2019 20:47:33 -0000 On Sun, Nov 03 2019, David Bremner wrote: > > @@ -32,10 +33,11 @@ def notmuch(maildir): > """ > cfg_fname = maildir.path / 'notmuch-config' > cmd = ['notmuch'] + list(args) > - print('Invoking: {}'.format(' '.join(cmd))) > + env = os.environ.copy() > + env['NOTMUCH_CONFIG'] = str(cfg_fname) > proc = subprocess.run(cmd, > timeout=5, > - env={'NOTMUCH_CONFIG': str(cfg_fname)}) > + env=env) Tried lambda (to have preexe_fn have cfg_fname in context), did not work, nested function also seems to hold context: alternative: ... print('Invoking: {}'.format(' '.join(cmd))) def preexec_fn(): os.environ['NOTMUCH_CONFIG'] = str(cfg_fname) proc = subprocess.run(cmd, timeout=5, preexec_fn=preexec_fn) ... The unix fork ... (here preexec_fn called in child) ... exec model is superior to any other alternative ! =D Tomi