Skip to content

Commit

Permalink
use shelx to properly escape command
Browse files Browse the repository at this point in the history
  • Loading branch information
rkm committed Nov 14, 2024
1 parent ff9e2c8 commit 16e7c2d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion roles/bin/templates/bin/_smi_wrapper.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# {{ ansible_managed }}
import argparse
import os
import shlex
import subprocess
import sys

Expand Down Expand Up @@ -64,7 +65,7 @@ def run(
print_smi_env()
if wrapper_args.copies > 1:
print(f"Executing {wrapper_args.copies} detached instances of:")
subprocess.check_call(("echo", "$", *cmd))
print(f"$ {shlex.join(cmd)}")

if wrapper_args.detach:
for _ in range(wrapper_args.copies):
Expand Down

0 comments on commit 16e7c2d

Please sign in to comment.