From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 16773 invoked from network); 20 Jun 2021 22:14:55 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 20 Jun 2021 22:14:55 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1624227296; b=hdn/UDBCIoF+/mo2uyGTKLcY9I8kGJUDYKjZrXL0Ignv6lZDwTuP4CgnA2Inn4tZcAwojGzC7L bgSc+CI1UFBHJ5/Ddx+jpKL0k1NlK1sT9O4KbFfJVmFj+ve8Sp/DKTJlpuSCQD92/AYsjDbvzZ qFQ0etHmEVcN1G8WE6FIekyyV86R+vMulUjnOu8c0k307IjiXCsJAqf8l73rxLmsN2hL3s84JM TwjhwRc26tVGaLGpzpUi5EFvETEpkqZijLFKJfh+iW9T2iroU5ht1YrNOgvaj/9jfQ5X6PrTf3 RMM+IZnPqGQXWb1XbPfisgYSgTcaHlOIVCFhbOGDAOuw8A==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-lj1-f172.google.com) smtp.remote-ip=209.85.208.172; dkim=pass header.d=gmail.com header.s=20161025 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20200801; t=1624227296; bh=cVJ9OmvL+CzWCQjqetDa5CGzIRioZvA+L2sJDLjKRPw=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:DKIM-Signature:DKIM-Signature; b=Yep6zONQWIIP4iah51of9inmTdi2DESWvH2zOUSMwknLfGp5Z9pcPHTWA3O33qBK38Xx178gCA GLTgqZRs8RttljQ6jNK81l0EDu9oGM8yWbWtp5k0eZFRj0Bh6ZG0Ek96dYH2c4CteYS4FHp287 61oPsShgm5pZAKf0nuzpJ/kKYSjLot3rt2oWu43EBPE5M0PhXlEpo6wFpw4N05kOldrg0xJJNG dHw8WwChuJmen6CpqNXKtOjy1R2trne+WdT7zUQ8FJtqaGi5VMHdWkvQhSHBKMP9K0+R1fUWL8 NN1YFWQ998wIRfdw+6M/gTpqJCZufMo+FuX534jZ9CmoZQ==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20200801; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID :Date:From:In-Reply-To:References:MIME-Version:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=LvtF3w+ZehT8b63PrAQYgR/ezViit2kGgR1wdYMj1rI=; b=BTp2+a5ci438hMVHW9fRpbAjEc BD0u6Zo0TycB8s7B7L0k/JSW8Xaj/3HzzrIpB0aTpT2ELM/KHR+shcNKGPIvYg9I2u5wUvIZpwKxm P4SPOpQyonZS+W+Wms/0QbfLY8gsV+Mj7r2Rd1Wc2c83fnHywRJKA5eZ32T+ygaUUFI8KtT0Wc50T dtxINlxePyBXtHrG7ZfEpoJvAYPLlHyFcmyjrx2+DFmtaZa4GWD4CRGC+qf9EXcaWSPQzgXq57hYH y8zrgwKfTjeN0vFlBBWM7sncVvvk+0J1ak4Xb/MDiQZig2UlCtvqCzMwLHzMUWp+FIzqxJEvYu0Ob fEaB6o0A==; Received: from authenticated user by zero.zsh.org with local id 1lv5iR-0009gH-Cl; Sun, 20 Jun 2021 22:14:55 +0000 Authentication-Results: zsh.org; iprev=pass (mail-lj1-f172.google.com) smtp.remote-ip=209.85.208.172; dkim=pass header.d=gmail.com header.s=20161025 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-lj1-f172.google.com ([209.85.208.172]:44004) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1lv5hu-0009N5-G7; Sun, 20 Jun 2021 22:14:22 +0000 Received: by mail-lj1-f172.google.com with SMTP id g13so12036057ljj.10 for ; Sun, 20 Jun 2021 15:14:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=LvtF3w+ZehT8b63PrAQYgR/ezViit2kGgR1wdYMj1rI=; b=swboP1+k7GmcYY4T8g/D6cJAMnWklNo3PCOkD1VFM7pJvj5yhNTQZ+OxKrPhIn77Cx GbficKRVVcfw6f/i6o/n7BJg8luJGVPhFjtgIYFXbS9tSO7B2ftNy/S/QANjfBAKruLt dYFt6mH6AdiHhUEHugzgXLnOBupF93pezPCm4rmdEfG+XqN+kDT5DvSLPtjuEznDZY+B cq3RjehEI4ruoKYoTFSyoR88f4dTtkAST1xzT6APwKwC6qcSysf4yxE9ZCYzwqiYlB0i 2FdwKLi2Cs/X3dhkF4dPnBUfDgany1lkGygUfipZL3+fM8iebVgewDH1FO6LveS30J/z hbRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=LvtF3w+ZehT8b63PrAQYgR/ezViit2kGgR1wdYMj1rI=; b=hTnOCi447cTgyTSqeTwiMVCA+9DfIxqWLAtrkPiqmrgQQIN4av8zlHxARHfZbGl320 tWdXVOOjplJeiX6R5z0pg5HcmWmwhPIzXTuHxG1XDGNClxrGHLR9ZexXAILIV2vBRT9n +XLVfg42id9j6g0iwfeqrdN5v9UMQ7Te3k3pmrurI2ok7P88B3O05aIxmiu5e9MHUTQt IIx72zePTajcXelrV7GeW/yZ++mOzdFo2YDbbZMmHRX/B2DhYGTzklgY97f1kEemq2CK ymb8KJJudeQOrvO1o3U56ok7b5YSMySNVgyNDy+fk1+6ZWa5+Hw5EcKT7ze989ZEkHHc Hw/A== X-Gm-Message-State: AOAM530hAe0IWDlEY1v6kJiHcDsOdyS5UXTg/DE5yqOmPtI7RehT56XC IqTB6Dn3ntvzrT3vhH2FtnrO7sktVOLgz1qr57U= X-Google-Smtp-Source: ABdhPJz+ixackrRAMQ+rQSHh67SFnAd6+U22k7FGnN2NsifqvKuzfswWZDAWCNSSR2VzXfXG/Uu5zuH26uYBFu6NliA= X-Received: by 2002:a2e:bf21:: with SMTP id c33mr19082194ljr.28.1624227261751; Sun, 20 Jun 2021 15:14:21 -0700 (PDT) MIME-Version: 1.0 References: <7E71FA83-356E-448B-9726-02DF3FF5BD14@gmail.com> <873D08A9-F321-474A-8440-CCE7DCCBA529@gmail.com> <20210414120551.GA3882@tarpaulin.shahaf.local2> <6CEA4F3E-9A64-44E1-9121-FA9D5E053AB5@gmail.com> <20210414140909.GG3882@tarpaulin.shahaf.local2> <29E16F69-B09E-44BF-9009-1CF53053D4FC@gmail.com> <20210416171321.GC4535@tarpaulin.shahaf.local2> <93FFDA3D-3C4A-414E-9220-1032ECE5B04C@gmail.com> <20210416193037.GD15670@tarpaulin.shahaf.local2> <9dc589f1-65b6-48b7-a7cb-81f9e2e16795@www.fastmail.com> <48174137-a8a7-4171-bcda-0899ebc19433@www.fastmail.com> <8082812e-b595-403b-9c8c-8956b6af08cd@www.fastmail.com> In-Reply-To: From: Marlon Richert Date: Mon, 21 Jun 2021 01:13:43 +0300 Message-ID: Subject: Re: [PATCH] Add customizable `vcs` prompt theme (was Re: [RFC][PATCH] `newuser` prompt theme) To: Roman Perepelitsa Cc: Zsh hackers list Content-Type: text/plain; charset="UTF-8" X-Seq: 49100 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: On Thu, Jun 10, 2021 at 8:45 PM Roman Perepelitsa wrote: > > I was expecting the readonly parameter at the top to print an error. > > % readonly -gHA _prompt_vcs_ps1_default=() > % readonly -gHA _prompt_vcs_ps1_default=() > zsh: read-only variable: _prompt_vcs_ps1_default That doesn't actually happen, because prompt_vcs_setup gets redefined inside the first call to prompt_vcs_setup. $_prompt_vcs_ps1_default gets set only the first time you call prompt_vcs_setup. > It's also unclear to me whether this prompt supports clean > deinitialization and repeated initialization. Doesn't look like it. > Does it? You're supposed to use this prompt theme with prompinit's `prompt` function. If you do so, then deinitialization and repeated initialization is pretty much clean, as far as I can tell. Is there anything in particular that I should be checking? > > > Why is prompt_vcs_precmd checking whether prompt_vcs_fd is a readable > > > fd? How can it not be? > > > > I don't know how or why, but if I don't check for that, then I get > > this error repeatedly: > > > > prompt_vcs_precmd:6: failed to close file descriptor 11: bad file descriptor > > Then the check must be masking a bug. This bug can result in the > closing of another file descriptor that is not owned by prompt_vcs. > > I took a quick look and perhaps the bug is due to prompt_vcs_fd-widget > not unsetting prompt_vcs_fd? You're right: Unsetting prompt_vcs_fd in prompt_vcs_fd-widget fixes it. Thanks! > I see that the code is sending SIGKILL now and not waiting for the > process to terminate. Both of these make me nervous. The code also > *looks like* it would work without monitor but it wouldn't (it would > result in unbounded background processes and zombies). What do you > think about not killing anything and ensuring that at most one > background process runs at once? This is what I do in my zsh theme and > it works well. That sounds great, but I have no idea how to do that. :) Can you give me some pointers? > Handling errors from `read` would be nice. What kind of errors?