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

修复 Linux 端 hostnamectl 命令不可用时无法与手机端同步的问题 #1784

Merged
merged 2 commits into from
Feb 14, 2024

Conversation

SamLukeYes
Copy link
Contributor

@SamLukeYes SamLukeYes commented Feb 14, 2024

hostnamectl 命令是 systemd 的一部分。在一些环境下,例如非 systemd 发行版或某些沙盒环境中,此命令可能不可用。目前 lx-music-desktop 在 Linux 端启用同步时会尝试通过 hostnamectl --pretty 来获取计算机名,在该命令执行失败时会导致手机端无法启用同步。此 PR 将执行此命令的代码放入 try 块中,使得在该命令未能正确执行的情况下也能回退到直接使用 os.hostname() 的方案。

不太熟悉 JS,临时照着 MDN 的文档 写的,如有写得不对的地方请指正😉

@lyswhut
Copy link
Owner

lyswhut commented Feb 14, 2024

thx!

@lyswhut lyswhut merged commit 15c9207 into lyswhut:dev Feb 14, 2024
1 check passed
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

Successfully merging this pull request may close these issues.

2 participants