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
|
|
|
|
|
2022-08-21 06:14:48 +00:00
|
|
|
#include "config.h"
|
2017-02-14 04:37:27 +00:00
|
|
|
|
2022-08-21 06:14:48 +00:00
|
|
|
#include <csignal>
|
|
|
|
#include <memory>
|
2005-10-04 15:11:39 +00:00
|
|
|
|
2022-08-21 06:14:48 +00:00
|
|
|
#include "flog.h"
|
|
|
|
#include "io.h"
|
2020-01-30 00:39:44 +00:00
|
|
|
#include "proc.h"
|
2005-10-04 15:11:39 +00:00
|
|
|
|
2022-08-21 06:14:48 +00:00
|
|
|
class parser_t;
|
|
|
|
|
2018-11-04 07:58:44 +00:00
|
|
|
/// Execute the processes specified by \p j in the parser \p.
|
2020-08-06 18:51:08 +00:00
|
|
|
/// On a true return, the job was successfully launched and the parser will take responsibility for
|
2020-07-26 17:45:02 +00: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 13:26:39 +00:00
|
|
|
|
2020-01-24 01:34:46 +00:00
|
|
|
/// Evaluate a command.
|
2016-04-29 02:41:54 +00:00
|
|
|
///
|
|
|
|
/// \param cmd the command to execute
|
2020-01-24 01:34:46 +00: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 02:41:54 +00:00
|
|
|
///
|
2020-01-24 01:34:46 +00:00
|
|
|
/// \return a value appropriate for populating $status.
|
|
|
|
int exec_subshell(const wcstring &cmd, parser_t &parser, bool apply_exit_status);
|
2019-03-14 18:15:50 +00:00
|
|
|
int exec_subshell(const wcstring &cmd, parser_t &parser, wcstring_list_t &outputs,
|
2020-01-24 01:34:46 +00: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-11 18:06:52 +00:00
|
|
|
/// halt expansion. If the \p pgid is supplied, then any spawned external commands should join that
|
|
|
|
/// pgroup.
|
2020-05-30 21:05:07 +00: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 03:18:46 +00:00
|
|
|
|
2020-04-05 08:24:26 +00: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 15:11:39 +00:00
|
|
|
#endif
|