From 2b7e61619148f3ab053689768bed6e58177b00d6 Mon Sep 17 00:00:00 2001 From: Nativu5 <44155313+Nativu5@users.noreply.github.com> Date: Mon, 20 May 2024 23:24:38 +0800 Subject: [PATCH] fix: Fix cmd string bug --- src/Craned/TaskExecutor.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Craned/TaskExecutor.cpp b/src/Craned/TaskExecutor.cpp index 13052af67..bff2bfb1d 100644 --- a/src/Craned/TaskExecutor.cpp +++ b/src/Craned/TaskExecutor.cpp @@ -324,10 +324,11 @@ CraneErr ProcessInstance::Spawn(util::Cgroup* cgroup) { } // e.g., /bin/bash -c "/bin/zsh script.sh --arg1 --arg2 ..." + auto cmd = fmt::format("{} {} {}", m_batch_meta_.interpreter, + m_executive_path_, arguments); + argv.emplace_back("-c"); - argv.emplace_back(fmt::format("\"{} {} {}\"", m_batch_meta_.interpreter, - m_executive_path_, arguments) - .c_str()); + argv.emplace_back(cmd.c_str()); argv.emplace_back(nullptr); execv(argv[0], const_cast(argv.data()));