diff --git a/src/glicid_spawner/slurm.py b/src/glicid_spawner/slurm.py index 22b5739..59e64af 100644 --- a/src/glicid_spawner/slurm.py +++ b/src/glicid_spawner/slurm.py @@ -140,9 +140,9 @@ def sinfo_run(username: str = None) -> str: cmd = f'sinfo {flags} --Format={fmt}' if username: - cmd = f'su - {username} -c "{cmd}"' + cmd = f"su - {username} -c '{cmd}'" - return subprocess.check_output(shlex.split(cmd, posix=False)).decode('utf-8') + return subprocess.check_output(shlex.split(cmd)).decode('utf-8') def sinfo_reader(result: str) -> list: diff --git a/tests/test_slurm.py b/tests/test_slurm.py index ff57c33..bcb9429 100644 --- a/tests/test_slurm.py +++ b/tests/test_slurm.py @@ -109,13 +109,12 @@ def test_slurm_sinfo_run(monkeypatch): ) assert sinfo_run(username='john-doe') == ( - 'su - john-doe -c "' + 'su - john-doe -c ' 'sinfo ' '--federation ' '--noheader ' '--responding ' '--Format=Cluster,PartitionName,NodeHost,StateLong,CPUsState,Memory,Gres' - '"' )