the shell used for command execution can be changed using the 'shell' option
This commit is contained in:
parent
33f87db553
commit
9230ccc087
|
@ -97,6 +97,7 @@ GlobalOptions::GlobalOptions()
|
|||
set_option("indentwidth", Option(4));
|
||||
set_option("eolformat", Option("lf"));
|
||||
set_option("BOM", Option("no"));
|
||||
set_option("shell", Option("sh"));
|
||||
set_option("complete_prefix", Option(1));
|
||||
set_option("ignored_files", Option(R"(^(\..*|.*\.(o|so|a))$)"));
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "shell_manager.hh"
|
||||
|
||||
#include "debug.hh"
|
||||
#include "context.hh"
|
||||
|
||||
#include <cstring>
|
||||
#include <sys/types.h>
|
||||
|
@ -116,14 +117,15 @@ String ShellManager::pipe(const String& input,
|
|||
|
||||
++it;
|
||||
}
|
||||
std::vector<const char*> execparams = { "sh", "-c", cmdline.c_str() };
|
||||
String shell = context.options()["shell"].as_string();
|
||||
std::vector<const char*> execparams = { shell.c_str(), "-c", cmdline.c_str() };
|
||||
if (not params.empty())
|
||||
execparams.push_back("sh");
|
||||
execparams.push_back(shell.c_str());
|
||||
for (auto& param : params)
|
||||
execparams.push_back(param.c_str());
|
||||
execparams.push_back(NULL);
|
||||
|
||||
execvp("sh", (char* const*)execparams.data());
|
||||
execvp(shell.c_str(), (char* const*)execparams.data());
|
||||
exit(-1);
|
||||
}
|
||||
catch (...) { exit(-1); }
|
||||
|
|
Loading…
Reference in New Issue
Block a user