15#include <util/pragma_push.def>
17#pragma warning(disable:4668)
19#pragma warning(disable:5039)
24#include <util/pragma_pop.def>
49int run(
const std::string &what,
const std::vector<std::string> &argv)
51 return run(what, argv,
"",
"",
"");
56#define STDOUT_FILENO 1
57#define STDERR_FILENO 2
126 perror((
"Failed to open " + name +
" file " + file).c_str());
133 int flags = 0, mode = 0;
157 perror((
"Failed to open " + name +
" file " + file).c_str());
169 if(src.find_first_of(
L" \t\n\v\"") == src.npos && !src.empty())
172 std::wstring result =
L"\"";
174 for(
auto it = src.begin();; ++it)
178 while(it != src.end() && *it ==
L'\\')
203 result.push_back(*it);
212 result.push_back(*it);
216 result.push_back(
L'"');
254 const std::string &what,
255 const std::vector<std::string> &argv,
262 std::wstring cmdline;
267 for(std::size_t i = 1; i < argv.size(); i++)
372 std::vector<char *>
_argv(argv.size()+1);
373 for(std::size_t i=0; i<argv.size(); i++)
376 _argv[argv.size()]=
nullptr;
389 perror(std::string(
"execvp "+what+
" failed").c_str());
411 perror(
"Waiting for child process failed");
457 if(src.find(
' ')==std::string::npos &&
458 src.find(
'"')==std::string::npos &&
459 src.find(
'&')==std::string::npos &&
460 src.find(
'|')==std::string::npos &&
461 src.find(
'(')==std::string::npos &&
462 src.find(
')')==std::string::npos &&
463 src.find(
'<')==std::string::npos &&
464 src.find(
'>')==std::string::npos &&
465 src.find(
'^')==std::string::npos)
475 for(
const char ch : src)
512 for(
const char ch : src)
526 const std::string &what,
527 const std::vector<std::string> &argv,
573 std::vector<char *>
_argv(argv.size() + 1);
574 for(std::size_t i = 0; i < argv.size(); i++)
577 _argv[argv.size()] =
nullptr;
590 perror(std::string(
"execvp " + what +
" failed").c_str());
621 perror(
"Waiting for child process failed");
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
int open(const char *pathname, int flags,...)
int __CPROVER_ID java::java io InputStream read
output_type narrow(input_type input)
Run-time checked narrowing cast.
int run(const std::string &what, const std::vector< std::string > &argv)
static fdt stdio_redirection(int fd, const std::string &file)
open given file to replace either stdin, stderr, stdout
std::string shell_quote(const std::string &src)
quote a string for bash and CMD
void remove_signal_catcher()
void register_child(pid_t pid)
#define UNREACHABLE
This should be used to mark dead code.
void perror(const char *s)
char * strdup(const char *str)
exprt buffer_size(const exprt &what)
std::wstring widen(const char *s)