Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH] _hdiutil: run candidate-collecting loops outside the pipeline subshell
- X-seq: zsh-workers 54636
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: Clay Caviness <clay@xxxxxxxxxx>
- Cc: zsh-workers@xxxxxxx
- Subject: Re: [PATCH] _hdiutil: run candidate-collecting loops outside the pipeline subshell
- Date: Sat, 30 May 2026 01:17:08 +0200
- Arc-authentication-results: i=1; mx.google.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=KAoahf+Z2erSw3cci0bGehv9OVGz6Lq6gHYf82cPPuE=; fh=QxJsPNQOlgRkGlHNK1PESJOipvlriq0v/QRyIe+59jE=; b=GhyGttsbNP7bRuKwBpZRpGto9rpOmBp+d3KjbKzwTA7CdxsA3LOqikW+I8wZgvVOu3 IjJbRy6orzwRYJrlczHuzmj8w3eXa8A5DqTQQzP+7pueD0CyUY78gTE8siLbaiISm4mV D5MG31iN6Vjt7HjQcTOBo9W6Oz1a8aWOJgW9vfSODiXvTgTkQJvFyya1xOn2cBm9vGVI QIl1ieHTKni3Io9834Nx0syneTUlOQd4Aie0rpneIecRzFR4JlAdlLTyfoWAeC6dW9Uh VzE/JWnrJk1W6+iPxLUTpcCW/8q2t7Xmewad80yGJkvOpjkA+tDmlKZ90uoGZErqjjmG 2ZDg==; darn=zsh.org
- Arc-seal: i=1; a=rsa-sha256; t=1780096641; cv=none; d=google.com; s=arc-20240605; b=Q5dtVJxqEJ+VUsXmdjH7tX2pyVrXywTmBI/QwXePyNVXqUnDfXA+T2Eja+ydOpfsB6 zB4Uk2SJKe6jputH2/13Di5q8NCIVlVyDq6IGVYIN0HMjRXg62dLrLX8aXIozyub8itj FLt22dzEdi5yYea1wAoPMz8fyUSc+97Dt3tAIXTyxOWCuhLDT3N91kRFNxo9S2B4TQws +qFMRlE1qCqzhEyWXYHFKe7Jq4iWksxL05DOvDeZfo1V55N7jMr4iyduwvxpwayv6eqG ZKh/nH+ODVIb7lvTiha3OGec2MagYNr0NZLBzvZBHeMs1DguBJU4/2XboFxY0ClZyB6n IwQA==
- Archived-at: <https://zsh.org/workers/54636>
- In-reply-to: <CANU2HreskxaTw-NapoNAtCeaOGDAHsNGy2EMx15o8Fdt=bvDhg@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- References: <CANU2Hre7vkud-DQC=V5-ys-ZKcbyCZxC3oNjBCMeBDXmzxCOUQ@mail.gmail.com> <CAHYJk3TX14fc8s6-BW8c0g0d8=hPjQ+O5RpzAupMM570=TGsKw@mail.gmail.com> <CANU2HreskxaTw-NapoNAtCeaOGDAHsNGy2EMx15o8Fdt=bvDhg@mail.gmail.com>
On Fri, May 29, 2026 at 10:05 PM Clay Caviness <clay@xxxxxxxxxx> wrote:
>
> I apologize for the incorrect diagnosis. My incorrect diagnosis stemmed from my own usage: I almost always invoke `hdiutil eject` with a mount point (`hdiutil eject /Volumes/Foo`). Therefore, when `hdiutil eject /<TAB>` produced no results, I assumed the helper was broken and thought the issue was with subshell semantics rather than realizing the completion only offers the bare entity identifier form (`disk4s1`). With an image actually attached and tabbing from a bare `hdiutil eject `, the existing helper works as designed.
>
> I'll withdraw this patch and work on another that implements the local/read -r changes, figure out if we should be using bare `hdiutil` or the full path (I think bare?) and see if I can add support for offering mount points and completions.
That makes sense, but do note also that compsys will local REPLY (and
other stuff) upon entry to the completion system, see line ~180 in
compinit where _comp_setup is set (this is eval'd when completion
starts). I don't have an osx machine so I don't know the output format
of this hdiutil, but if it can output arbitrary paths separated by
newlines, then IFS= read -r is usually the way to go to avoid problems
with spaces and backslashes. The other option is something like local
-a output=( ${(f)"$(hdiutil blabla)"} ) which explicitly splits the
raw output only by newlines. I'm assuming there won't exactly be
megabytes of output here so the streambased foo | while read handling
isn't strictly needed. That said, if it only ever outputs simple ascii
identifiers like disk4s1 then there's not really any reason to change
anything.
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author