This channel is intended for people just starting with the Raku Programming Language (raku.org). Logs are available at irclogs.raku.org/raku-beginner/live.html Set by lizmat on 8 June 2022. |
|||
aruniecrisps | @lizmat what do you think of this idea? github.com/Raku/problem-solving/issues/421 | 00:08 | |
the latest comment i mean | |||
03:13
MasterDuke left
07:53
hudo__ joined
07:56
hudo_ left
08:35
KOTP left
08:36
KOTP joined
09:32
human-blip left,
human-blip joined
|
|||
doodler8888 | printing the '$repos' variable gives '(Pipe)' at the end of the output: my $repos = shell("find ~/ -type d -name '.git' -not -path '*/.local/*' -not -path '*/.share/*' -printf '%p\n' 2>/dev/null").out; say $repos; The output example: /home/username/.cache/paru/clone/nvm/.git /home/username/.cache/paru/clone/hadolint-bin/.git /home/username/.cache/paru/clone/lem-editor-git/.git (Pipe) is there any | 12:01 | |
quick way to remove the '(Pipe)' line? | |||
Nahita | so by default the STDOUT goes to STDOUT and you don't specify something for the :$out parameter of the shell, so this is the case for you | 12:13 | |
what I mean is, if you comment say $repos, you'll see the ".git" outputs still | |||
and "(Pipe)" won't be there | |||
that's because by doing .out you get a handle on the STDOUT, which is a special IO::Pipe object, and it prints its string form at the end | 12:14 | ||
i hope this makes sense, and a fix for your desired outcome is, e.g., pass :out to shell function which means out => True but in a short form | |||
and the documentation says that if you pass True there, it will do: > Setting one (or more) of them to True makes the stream available as an IO::Pipe object of the same name, like for example $proc.out | 12:15 | ||
doodler8888 | aah, got it, thx! | ||
Nahita | and shell returns a Proc object, so now you'll be able to do: raku my $repos = shell("...", :out); say $repos.out.slurp(:close) | ||
no problem | |||
14:19
jgaz joined
15:17
saint- joined
21:54
MasterDuke joined
22:17
jgaz left
22:46
MasterDuke left
|