Skip to content

Commit

Permalink
Make checking for Windows cheaper
Browse files Browse the repository at this point in the history
The R:I.IS-WIN method doesn't need to actually initialized $*DISTRO,
and as such will not actually shell out on some OS's, which will in
turn not cause the threadpool supervisor thread to be started.
  • Loading branch information
lizmat committed Aug 19, 2021
1 parent 289a62f commit 89df7f4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/core.c/CompUnit/PrecompilationStore/File.pm6
Expand Up @@ -309,7 +309,7 @@ class CompUnit::PrecompilationStore::File
Str:D :$extension = ''
) {
my &rename-block = { $path.rename(self!file($compiler-id, $precomp-id, :$extension)); };
if $*DISTRO.is-win {
if Rakudo::Internals.IS-WIN {
# If the rename attempts don't succeed, we'll end up
# trying again one more time but not catching any failures.
return if try-rename-n-times(&rename-block, 10);
Expand All @@ -328,7 +328,7 @@ class CompUnit::PrecompilationStore::File
$precomp-file.rename(self!file($compiler-id, $precomp-id));
self.remove-from-cache($precomp-id);
};
if $*DISTRO.is-win {
if Rakudo::Internals.IS-WIN {
# If the rename attempts don't succeed, we'll end up
# trying again one more time but not catching any failures.
return if try-rename-n-times(&rename-block, 10);
Expand All @@ -344,7 +344,7 @@ class CompUnit::PrecompilationStore::File
my $repo-id-file := self!file($compiler-id, $precomp-id, :extension<.repo-id.tmp>);
$repo-id-file.spurt($repo-id);
my &rename-block = { $repo-id-file.rename(self!file($compiler-id, $precomp-id, :extension<.repo-id>)); };
if $*DISTRO.is-win {
if Rakudo::Internals.IS-WIN {
# If the rename attempts don't succeed, we'll end up
# trying again one more time but not catching any failures.
return if try-rename-n-times(&rename-block, 10);
Expand Down
6 changes: 3 additions & 3 deletions src/core.c/REPL.pm6
Expand Up @@ -44,7 +44,7 @@ do {
my &add_history = $WHO<&add_history>;
my $Readline = try { require Readline }
my $read = $Readline.new;
if ! $*DISTRO.is-win {
if !Rakudo::Internals.IS-WIN {
$read.read-init-file("/etc/inputrc");
$read.read-init-file(%*ENV<INPUTRC> // "~/.inputrc");
}
Expand Down Expand Up @@ -238,7 +238,7 @@ do {
say 'Continuing without tab completions or line editor';
say 'You may want to consider using rlwrap for simple line editor functionality';
}
elsif !$*DISTRO.is-win and !( %*ENV<_>:exists and %*ENV<_>.ends-with: 'rlwrap' ) {
elsif !Rakudo::Internals.IS-WIN and !( %*ENV<_>:exists and %*ENV<_>.ends-with: 'rlwrap' ) {
say 'You may want to `zef install Readline` or `zef install Linenoise` or use rlwrap for a line editor';
}
say '';
Expand Down Expand Up @@ -321,7 +321,7 @@ do {

say $no-exit
?? "Type 'exit' to leave"
!! $*DISTRO.is-win
!! Rakudo::Internals.IS-WIN
?? "To exit type 'exit' or '^Z'"
!! "To exit type 'exit' or '^D'";

Expand Down

0 comments on commit 89df7f4

Please sign in to comment.