Skip to content

Commit

Permalink
fix: Fix cmd string bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Nativu5 committed May 20, 2024
1 parent 3510687 commit 2b7e616
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Craned/TaskExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<char* const*>(argv.data()));
Expand Down

0 comments on commit 2b7e616

Please sign in to comment.