2016-04-29 02:41:54 +00:00
|
|
|
// Prototypes for functions for executing a program.
|
2005-10-04 15:11:39 +00:00
|
|
|
#ifndef FISH_EXEC_H
|
|
|
|
#define FISH_EXEC_H
|
|
|
|
|
2015-07-25 15:14:25 +00:00
|
|
|
#include <stddef.h>
|
2017-02-14 04:37:27 +00:00
|
|
|
|
2011-12-27 03:18:46 +00:00
|
|
|
#include <vector>
|
2005-10-04 15:11:39 +00:00
|
|
|
|
2011-12-27 03:18:46 +00:00
|
|
|
#include "common.h"
|
2005-10-04 15:11:39 +00:00
|
|
|
|
2016-04-29 02:41:54 +00:00
|
|
|
/// Pipe redirection error message.
|
2006-01-04 12:51:02 +00:00
|
|
|
#define PIPE_ERROR _(L"An error occurred while setting up pipe")
|
2005-10-08 11:20:51 +00:00
|
|
|
|
2018-11-04 07:58:44 +00:00
|
|
|
/// Execute the processes specified by \p j in the parser \p.
|
2015-07-25 15:14:25 +00:00
|
|
|
class job_t;
|
2019-12-12 00:34:20 +00:00
|
|
|
struct job_lineage_t;
|
2012-01-23 04:47:13 +00:00
|
|
|
class parser_t;
|
2019-12-27 05:54:21 +00:00
|
|
|
bool exec_job(parser_t &parser, const std::shared_ptr<job_t> &j, const job_lineage_t &lineage);
|
2005-09-20 13:26:39 +00:00
|
|
|
|
2016-04-29 02:41:54 +00:00
|
|
|
/// Evaluate the expression cmd in a subshell, add the outputs into the list l. On return, the
|
|
|
|
/// status flag as returned bu \c proc_gfet_last_status will not be changed.
|
|
|
|
///
|
|
|
|
/// \param cmd the command to execute
|
|
|
|
/// \param outputs The list to insert output into.
|
|
|
|
///
|
|
|
|
/// \return the status of the last job to exit, or -1 if en error was encountered.
|
2019-03-14 18:15:50 +00:00
|
|
|
int exec_subshell(const wcstring &cmd, parser_t &parser, wcstring_list_t &outputs,
|
2019-11-19 00:54:36 +00:00
|
|
|
bool apply_exit_status, bool is_subcmd = false);
|
|
|
|
int exec_subshell(const wcstring &cmd, parser_t &parser, bool apply_exit_status,
|
2017-07-27 03:17:04 +00:00
|
|
|
bool is_subcmd = false);
|
2011-12-27 03:18:46 +00:00
|
|
|
|
2016-04-29 02:41:54 +00:00
|
|
|
/// Loops over close until the syscall was run without being interrupted.
|
2012-11-19 00:30:30 +00:00
|
|
|
void exec_close(int fd);
|
2005-09-20 13:26:39 +00:00
|
|
|
|
2016-04-29 02:41:54 +00:00
|
|
|
/// Gets the interpreter for a given command.
|
2012-11-19 00:30:30 +00:00
|
|
|
char *get_interpreter(const char *command, char *interpreter, size_t buff_size);
|
2012-02-28 23:11:46 +00:00
|
|
|
|
2005-10-04 15:11:39 +00:00
|
|
|
#endif
|