Subject: Re: bug#50283: HwInfo
From: Maxim Cournoyer <[email-masked]>
To: Raghav Gururajan <[email-masked]>
Cc: Ricardo Wurmus <[email-masked]>, [email-masked], [email-masked]
Date: Thu, 23 Jun 2022 11:35:04 -0400
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi,

Raghav Gururajan <[email-masked]> writes:

> Hi Ricardo!
>
>> --8<---------------cut here---------------start------------->8---
>> (substitute* "hw-probe.pl"
>>    (("Cmd\\(\"([^\"]+)" _ command)
>>     (string-append "Cmd(\"" (which command))))
>> --8<---------------cut here---------------end--------------->8---
>
> Thanks for the snippet and explanation.
>
> I am wondering these,
> [1] Does require import of specific modules?

No.  `which', the Scheme procedure, is part of (guix build utils).

> [2] If `(which command)`'s output is empty, will it return #f?

Yes, and I agree that's a problem.

Fortunately, the recently added search-input-file more usefully raises
an error when the file it is looking for doesn't exist, so I used that.

It was a bit painful to hunt all the commands but in the end it works
beautifully!  I pushed the result as
3611f99affc4d2edcf4141e3022dd0d2a0b04068.

Closing, thanks!

Maxim