2016-04-29 10:41:54 +08:00
|
|
|
// Prototypes for functions for executing a program.
|
2005-10-04 23:11:39 +08:00
|
|
|
#ifndef FISH_EXEC_H
|
|
|
|
#define FISH_EXEC_H
|
|
|
|
|
2015-07-25 23:14:25 +08:00
|
|
|
#include <stddef.h>
|
2017-02-14 12:37:27 +08:00
|
|
|
|
2011-12-27 11:18:46 +08:00
|
|
|
#include <vector>
|
2005-10-04 23:11:39 +08:00
|
|
|
|
2011-12-27 11:18:46 +08:00
|
|
|
#include "common.h"
|
2020-01-30 08:39:44 +08:00
|
|
|
#include "proc.h"
|
2005-10-04 23:11:39 +08:00
|
|
|
|
2018-11-04 15:58:44 +08:00
|
|
|
/// Execute the processes specified by \p j in the parser \p.
|
2020-08-07 02:51:08 +08:00
|
|
|
/// On a true return, the job was successfully launched and the parser will take responsibility for
|
2020-07-27 01:45:02 +08:00
|
|
|
/// cleaning it up. On a false return, the job could not be launched and the caller must clean it
|
|
|
|
/// up.
|
|
|
|
__warn_unused bool exec_job(parser_t &parser, const std::shared_ptr<job_t> &j,
|
|
|
|
const io_chain_t &block_io);
|
2005-09-20 21:26:39 +08:00
|
|
|
|
2020-01-24 09:34:46 +08:00
|
|
|
/// Evaluate a command.
|
2016-04-29 10:41:54 +08:00
|
|
|
///
|
|
|
|
/// \param cmd the command to execute
|
2020-01-24 09:34:46 +08:00
|
|
|
/// \param parser the parser with which to execute code
|
|
|
|
/// \param outputs the list to insert output into.
|
|
|
|
/// \param apply_exit_status if set, update $status within the parser, otherwise do not.
|
2016-04-29 10:41:54 +08:00
|
|
|
///
|
2020-01-24 09:34:46 +08:00
|
|
|
/// \return a value appropriate for populating $status.
|
|
|
|
int exec_subshell(const wcstring &cmd, parser_t &parser, bool apply_exit_status);
|
2019-03-15 02:15:50 +08:00
|
|
|
int exec_subshell(const wcstring &cmd, parser_t &parser, wcstring_list_t &outputs,
|
2020-01-24 09:34:46 +08:00
|
|
|
bool apply_exit_status);
|
|
|
|
|
|
|
|
/// Like exec_subshell, but only returns expansion-breaking errors. That is, a zero return means
|
|
|
|
/// "success" (even though the command may have failed), a non-zero return means that we should
|
2020-03-12 02:06:52 +08:00
|
|
|
/// halt expansion. If the \p pgid is supplied, then any spawned external commands should join that
|
|
|
|
/// pgroup.
|
2020-05-31 05:05:07 +08:00
|
|
|
int exec_subshell_for_expand(const wcstring &cmd, parser_t &parser,
|
|
|
|
const job_group_ref_t &job_group, wcstring_list_t &outputs);
|
2011-12-27 11:18:46 +08:00
|
|
|
|
2016-04-29 10:41:54 +08:00
|
|
|
/// Loops over close until the syscall was run without being interrupted.
|
2012-11-19 08:30:30 +08:00
|
|
|
void exec_close(int fd);
|
2005-09-20 21:26:39 +08:00
|
|
|
|
2020-04-05 16:24:26 +08:00
|
|
|
/// Add signals that should be masked for external processes in this job.
|
|
|
|
bool blocked_signals_for_job(const job_t &job, sigset_t *sigmask);
|
|
|
|
|
2005-10-04 23:11:39 +08:00
|
|
|
#endif
|