Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The notify() function in a WSL environment #102

Closed
mark-alexandre opened this issue Mar 27, 2024 · 10 comments
Closed

The notify() function in a WSL environment #102

mark-alexandre opened this issue Mar 27, 2024 · 10 comments

Comments

@mark-alexandre
Copy link

mark-alexandre commented Mar 27, 2024

Hello,

I'm in a WSL2 environment under Windows 11 in order to launch my Castor commands and with the Castor.PHAR archive for Windows (since it's this one to take even for WSL). I just tried your notification function but it doesn't trigger any notification.

I have checked my notifications options btw, and everything is properly configured. I wonder the reason behind this : is this a WSL related issue which can't communicate properly with Windows ?

#[AsTask(description: 'Suppression des volumes, conteneurs et réseaux créés pour le projet')]
function clean(bool $force = false)
{
    notify('The infrastructure has been destroyed.');
}
@TheoD02
Copy link

TheoD02 commented Mar 27, 2024

Hey,

WSL user too, can you provide some information about version of Windows and WSL ? wsl --version

See a little discussion here about WSL 2 notification : jolicode/castor#334

I had the same problem before, but now it works, but I'm on WSL pre-release (W11).

@mark-alexandre
Copy link
Author

mark-alexandre commented Mar 28, 2024

Hi,

I had to do a wsl --list --verbose for this (wsl --version just doesn't work and display the wsl help) :

image

I'm on WSL 2.

[EDIT] Don't pay attention to the docker-data which is stopped, It is usually on and was on during the notification test.

@TheoD02
Copy link

TheoD02 commented Mar 28, 2024

Hi,

I had to do a wsl --list --verbose for this (wsl --version just doesn't work and display the wsl help) :

image

I'm on WSL 2.

[EDIT] Don't pay attention to the docker-data which is stopped, It is usually on and was on during the notification test.

Strange, you have an older version of WSL, I think.
When did you install it, and did you update it? (wsl --update)

Can you attempt to run wsl --status ?

Which distribution do you use?
Windows 10 or 11 ?

@mark-alexandre
Copy link
Author

mark-alexandre commented Mar 28, 2024

I'm using Windows 11. It's a professionnal computer delivered by my company in which I have limited rights. But yeah, you have probably right : my system seems to not be up to date.

image

I have just few seconds ago activated the necessary additionnal options in Windows Update (as described on the provided screenshot) and I'm waiting for the update to complete. This will probably resolve the issue. I was sure that WSL was already managed by Windows Update, but this is not the case and probably the reason behind this notification command not working.

When done, i'll reply to this thread in order to close it or give your more details about the issue.

@mark-alexandre
Copy link
Author

mark-alexandre commented Mar 28, 2024

Well, wsl 2 is now fully updated, but the notification just doesn't appear when the function is launched. Because I'm on a locked system (limited Windows privileges), I don't know if I should close the ticket or if you would like to investigate further. Maybe the issue is not related to these system limitations and a real issue could really exists in the base code, but maybe not.

[EDIT] When doing a wsl --version (which works now), I have this output :

image

As you can see, WSL is up to date. But I have just noted a weird information : the Windows version. I'm on Windows 11 for 2 years on this PC, and I wonder why it says it's in v10.0.22631.3374

@TheoD02
Copy link

TheoD02 commented Mar 29, 2024

Ok good to known, you have been updated to latest and higher Windows version 😄
(10.0.x is OK for W11)

But the strange thing is that on my professional PC I have no problem running notify whatever the executable (Windows or Linux phar/binary).

Except that on my personal PC it doesn't work, and all versions are up-to-date except Windows.

I got an error about the missing sonartoast. But it appeared once and then disappeared.

Now, castor plays the script without errors, but no notification is displayed 😞

What is your use case compared to mine?

Test script:
image

Error throwed with linux phar/binary (only one time):
image

When using Windows phar/binary:
Nothing appear (no throw, no notification on Windows)

EDIT:

Okay, I've figured out my error, I've used the repo's castor.php with the deps installed, that makes it resolve snoretoast and show me the notifications properly.

I'll try to find a fix for this case. Because even the windows phar doesn't seem to fix the problem on my side.

@lyrixx, @pyrech Did you have any confirmation that the use of Windows phar fix notifications internally at your company ?

@lyrixx
Copy link
Member

lyrixx commented Apr 1, 2024

@lyrixx, @pyrech Did you have any confirmation that the use of Windows phar fix notifications internally at your company ?

I (We) don't use Windows :/

@lyrixx lyrixx transferred this issue from jolicode/castor Apr 4, 2024
@lyrixx
Copy link
Member

lyrixx commented Apr 4, 2024

For the record, I have moved the issue from castor to jolinotif.

@mark-alexandre
Copy link
Author

When using Windows phar/binary: Nothing appear (no throw, no notification on Windows)

I have exactly the same behavior.

@pyrech
Copy link
Member

pyrech commented May 14, 2024

Since JoliNotif 2.7 was released with a better support of WSL, I'm going to close the issue as completed.

JoliNotif has also been updated inside Castor, so notification support should be quite better in the next release of Castor.

Thanks everyone

@pyrech pyrech closed this as completed May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants