mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-12-05 20:45:43 +00:00
Take the live cores only from a file holding exactly one line
This commit is contained in:
1 parent
c35417dfcc
commit
c3bda06e9e
2 files changed
+3
-3
No files matched your search
@@ -227,8 +227,8 @@ dd_components() {
|
||||
|
||||
DD_GAME_CPUS_SETUP = """
|
||||
dd_game_cpus() {
|
||||
local live=/root/.config/droiddeck/game-cores cpus
|
||||
if [ -f "$live" ] && IFS= read -r cpus <"$live" 2>/dev/null; then
|
||||
local live=/root/.config/droiddeck/game-cores cpus rest=
|
||||
if [ -f "$live" ] && { IFS= read -r cpus && ! IFS= read -r rest; } <"$live" 2>/dev/null && [ -z "$rest" ]; then
|
||||
[[ -z $cpus || $cpus =~ ^[0-9]+(-[0-9]+)?(,[0-9]+(-[0-9]+)?)*$ ]] || cpus=${DD_GAME_CPUS:-}
|
||||
if [ -z "$cpus" ] && [ -n "${DD_CLIENT_CPUS:-}" ]; then
|
||||
cpus=$(nproc --all 2>/dev/null) && cpus=0-$((cpus - 1)) || cpus=
|
||||
|
||||
@@ -54,7 +54,7 @@ class LiveGameCpusTest(unittest.TestCase):
|
||||
self.assertEqual(self.run_setup(partial, DD_GAME_CPUS="4,5"), ["taskset=taskset -c 4,5", "cpus=4,5"], partial)
|
||||
|
||||
def test_an_unreadable_value_keeps_the_session_value(self):
|
||||
for bad in ("3;rm\n", "6-\n", "-3\n", "3,,4\n", "3,\n"):
|
||||
for bad in ("3;rm\n", "6-\n", "-3\n", "3,,4\n", "3,\n", "3\n4\n", "3\n4", "\n3\n"):
|
||||
self.assertEqual(self.run_setup(bad, DD_GAME_CPUS="4,5"), ["taskset=taskset -c 4,5", "cpus=4,5"], bad)
|
||||
|
||||
def test_the_file_is_found_whatever_home_the_client_runs_with(self):
|
||||
|
||||
Reference in new issue
Block a user