Take the live cores only from a file holding exactly one line

This commit is contained in:
maxjivi05 committed 2026-11-27 03:25:53 -05:00
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=
+1 -1
View File
@@ -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):