00:04 yewscion joined 00:09 yewscion left 00:43 elcaro left, elcaro joined 00:56 yewscion joined 01:01 yewscion left 01:42 hulk joined 01:43 kylese left 02:04 yewscion joined 02:09 yewscion left 02:12 yewscion joined 02:15 hulk left, kylese joined 02:18 yewscion left 02:30 yewscion joined 02:34 yewscion left 02:36 yewscion joined 02:44 yewscion left 02:47 yewscion joined 02:52 yewscion left 03:03 yewscion joined 03:08 yewscion left 03:13 yewscion joined 03:17 yewscion left 03:39 yewscion joined 03:43 Aedil joined, yewscion left 03:45 kylese left 03:47 yewscion joined 03:49 kylese joined 03:52 yewscion left 04:03 yewscion joined 04:09 yewscion left 04:30 yewscion joined 04:34 yewscion left 05:39 yewscion joined 05:44 yewscion left 05:48 yewscion joined 05:53 yewscion left 06:04 yewscion joined 06:09 yewscion left 06:30 yewscion joined 06:35 yewscion left 06:38 yewscion joined 06:43 yewscion left 07:13 yewscion joined 07:17 yewscion left 07:18 Sgeo left 07:21 yewscion joined 07:27 yewscion left 07:39 yewscion joined 07:43 yewscion left 07:55 dakkar joined 08:26 camelia left 08:30 yewscion joined 08:35 yewscion left 08:39 yewscion joined 08:42 camelia joined 08:44 yewscion left 08:49 LainIwakura joined 08:56 lichtkind joined 09:04 yewscion joined
Geth ¦ App-Rakubrew: patrickbkr self-assigned Shell init for PowerShell is specific to Windows github.com/Raku/App-Rakubrew/issues/88 09:05
09:09 yewscion left 09:21 yewscion joined 09:26 yewscion left 09:32 yewscion joined 09:44 yewscion left 10:04 yewscion joined 10:09 yewscion left 10:20 yewscion joined 10:24 LainIwakura left 10:26 yewscion left 10:38 yewscion joined 10:43 yewscion left 11:07 yewscion joined 11:19 LainIwakura joined 11:34 yewscion left 11:39 yewscion joined 11:43 yewscion left 11:53 LainIwakura left 11:57 yewscion joined 12:01 yewscion left 12:22 yewscion joined 12:27 yewscion left 12:30 yewscion joined 12:35 yewscion left 12:39 yewscion joined 12:44 yewscion left, human-blip left, human-blip joined 12:46 yewscion joined 12:51 yewscion left 12:58 oodani left 13:01 Xliff joined
Xliff \o 13:01
Is there a way I can actually use raku to change the actual current directory of my environment? 13:03
By this, I mean change the actual working directory, not just $*CWD
13:04 yewscion joined 13:08 oodani joined 13:09 yewscion left 13:12 yewscion joined 13:18 yewscion left 13:24 yewscion joined 13:30 human-blip left 13:32 human-blip joined, yewscion left 13:35 yewscion joined
timo you want to change what the directory of the shell you are calling raku from is? 13:38
that can only happen if you get a command to the shell somehow to ask it to change its directory. there are many ways to do that, but nothing built into rakudo would be able to do it. same difficulty with a shell script that is run with ./bla.sh - without something additional it won't be able to chdir the calling shell's pwd 13:39
cwd*
Xliff Damn. 13:56
I think calling a subshell with the dir set to the right dir would be enough, but I don't know how much infrastructure I would need. 13:57
I think zef does something like that. I might start there. Thanks!
13:58 guifa_ left 14:02 guifa joined
Voldenet well you can change actual cwd, but it's going to be a mess 14:03
m: use NativeCall;sub getcwd(Pointer, size_t) returns Pointer is native { * }; sub chdir(Str) returns int32 is native { * }; sub free(Pointer) is native { * }; sub xgetcwd() { getcwd(Pointer, 0) andthen ($_, nativecast(Str, $_)) andthen free(.[0]), .[1].return orelse fail };say xgetcwd(); chdir("/"); say xgetcwd();
camelia /home/camelia
/
Voldenet and the mess starts here
m: use NativeCall;sub getcwd(Pointer, size_t) returns Pointer is native { * }; sub chdir(Str) returns int32 is native { * }; sub free(Pointer) is native { * }; sub xgetcwd() { getcwd(Pointer, 0) andthen ($_, nativecast(Str, $_)) andthen free(.[0]), .[1].return orelse fail };say xgetcwd(); chdir("/"); say xgetcwd(); say $*CWD
camelia /home/camelia
/
"/home/camelia".IO
Voldenet though it can help if some code is using getcwd 14:04
timo changing the CWD like that will still not change the CWD of the parent process though :) 14:06
and yes, $*CWD is purely handled inside rakudo and does not bother to read the process's CWD more than once, if i remember correctly 14:07
the "real" CWD has the drawback of being per-process, and raku tries to eliminate some gotchas when multithreading, like one "chdir" in one thread suddenly changing the cwd in all other threads, and the threads fighting over where what is executed from :) 14:08
Voldenet I don't think the original question was about parent process, but yeah, the approach has a lot of problems
$*CWD is the most obvious one 14:09
timo oh, Xliff you meant the underlying CWD that the process has by "your environment"? 14:10
Voldenet I really adore how you get the pointer that you have to free, is there some way to make this more automatic 14:12
timo well you don't *have* to free it :) :)
Voldenet I've seen one toy that actually never deallocated anything - it was very simple thanks to no keeping track of pointers ;P 14:13
timo i think it's easier to use CArray than Pointer there
since the storage inside the CArray is freed by moar when the CArray gets garbage-collected 14:14
Voldenet but then getcwd doesn't allocate this for you
timo oh that's what you get when you pass a null pointer?
then you should be able to say "returns Str" on the getcwd function 14:15
m: use NativeCall; sub getcwd(Pointer, size_t) returns Str is native { * }; say getcwd(Pointer, 0);
camelia /home/camelia
timo m: use NativeCall; sub getcwd(Pointer, size_t) returns Str is native { * }; say getcwd(Pointer, 0); sub chdir(Str) returns int32 is native { * }; chdir("/tmp/"); say getcwd(Pointer, 0); 14:16
camelia /home/camelia
/tmp
Voldenet oh, that is nice
14:16 yewscion left 14:26 yewscion joined
Xliff In the end, this works well enough, even though I now need another `exit`: 14:29
my $e = %*ENV; $e<SERVICE-SHELL> = 1; shell($e<SHELL>, cwd => "/", env => $e)
evalable6 Use of uninitialized value element of type Any in string context.
Methods .^name, .raku, .gist, or .say can be used to stringify it to something meaningful.
in block <unit> at /tmp/mWplyXvOnq line 1
timo can you be more specific what issue you are trying to solve? running stuff with "run" or "exec" or "shell" should already honor $*CWD. maybe the difficulty is that the code that's trying to change $*CWD is actually working with another instance of the $*CWD variable name than the spot that tries to run something? and you do want to communicate the change across threads in some way - maybe an actually 14:31
global variable
14:31 yewscion left 14:34 yewscion joined 14:40 yewscion left 14:46 yewscion joined 14:54 yewscion left 15:02 guifa left 15:03 guifa joined 15:12 yewscion joined 15:17 yewscion left 15:19 yewscion joined 15:25 yewscion left 15:29 yewscion joined
Xliff timo: Actually, I've solved the issue. All I wanted was a shell opened at a raku-determined directory. 16:22
timo oh! well, that should just be something like `run($*SHELL)` 16:25
no, %*ENV<SHELL> of course
16:35 dakkar left 16:40 Xliff left 17:03 yewscion left 17:11 yewscion joined 17:24 yewscion left 17:26 yewscion joined 17:32 Xliff joined
Xliff What's the best way to get the mime type of a file in Raku? 17:34
Just use `file` or is there a module that is NOT Mime::Types?
Grr.... "MIME::Types.new.type( $file.IO.extension )" 17:36
Which is such a hack. I was hoping for a Raku interface to `file` 17:37
And that isn't much better at: 17:38
'qqx<file --mime-type covid.json>.words.tail.say'
Voldenet you don't need tail 17:45
-b
qqx<file -b --mime-type $file>.trim.say 17:46
erm
qqx<file -b --mime-type "$file">.trim.say 17:47
Xliff Ah! Thx
Is there no watch-recursive for IO::Path? 18:18
18:22 ecocode left 18:59 lizmat left 19:01 lizmat joined
lizmat Xliff: I think not, PR's welcome :-) 19:04
Xliff lizmat: When I figure out how one should work, I'll submit it! 19:29
lizmat ++Xliff :-) 19:30
Xliff lizmat: Maybe wrap both in a MIME::Detect module or something.
19:30 librasteve_ joined
lizmat ah, I though you meant IO::Path.watch-recursive ? 19:30
Xliff lizmat: Ah! I was searching around for that and it turns out the answer is GIO! # github.com/Xliff/p6-GIO 19:31
librasteve there's one in Cro::WebAPP::Template iirc 19:32
Xliff lizmat: see github.com/Xliff/p6-GIO/blob/main/.../Local.pm6
lizmat noted, too tired to really look at it now 19:33
Xliff OK. How is the summit?
librasteve use OO::Monitors;
lizmat Xliff: it's over now, everybody's home, or close to being home again 19:34
librasteve oh no not that
Xliff lizmat: How was it?
And is there video?
lizmat it was very good for me, I think that goes for everybody
no
some of us discussing in groups, while others where co-hacking, and vice-versa :-) 19:35
Xliff Ah.
timo yeah there weren't really presentations as such 19:42
librasteve aha github.com/croservices/cro/blob/21...kumod#L121 19:43
its in cro run of course ^^
timo if i remember correctly, one folder being watched uses one file descriptor, and the "number of open files" ulimit is often relatively tight on linux 19:45
1024 on my system apparently. i really should turn that up by at least 16x
Xliff timo: Yeah, that's something to keep in mind, however the monitor I will be using is provided by libgio, not raku 19:56
timo: Seems safer to use a C-interface for that.
19:57 Xliff left
guifa ulimit is also really low on macos 19:57
I regularly hit issues with it when installing modules 19:58
antononcube ... or using Web APIs. 19:59
timo ah, i have a very much higher "hard" limit for number of open files, but the soft limit is 1024 (look at yours with `ulimit -Hn`) 20:00
.tell Xliff I recommend checking in the /proc/blabla/fdinfo or /proc/blabla/fd folder if there's a boatload of file descriptors being used for monitoring when you use libgio 20:02
tellable6 timo, I'll pass your message to Xliff
20:48 avuserow left 20:54 ACfromTX left 21:04 Aedil left 21:07 ACfromTX joined 21:29 yewscion left 21:46 tejr_ joined 21:48 tejr left, tejr_ is now known as tejr 22:20 ecocode joined 22:55 Xliff joined
Xliff \o 22:55
tellable6 2025-06-10T20:02:46Z #raku <timo> Xliff I recommend checking in the /proc/blabla/fdinfo or /proc/blabla/fd folder if there's a boatload of file descriptors being used for monitoring when you use libgio
Xliff timo: What do you mean by that? Checking /proc to see if there are leaks? 22:56
timo: Noted, then. If that becomes a problem, I'll try and write some telemetry code for it. 22:57
23:19 lichtkind left 23:21 yewscion joined 23:23 yewscion left 23:25 yewscion joined 23:32 Sgeo joined 23:43 yewscion left 23:45 yewscion joined 23:53 Guest64 joined
Guest64 Please recommend a HMTL template module for raku 23:53
23:55 yewscion left, yewscion joined 23:58 yewscion left 23:59 yewscion joined