mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-24 22:48:36 +08:00
14d2a6d8ff
Let's hope this doesn't causes build failures for e.g. musl: I just know it's good on macOS and our Linux CI. It's been a long time. One fix this brings, is I discovered we #include assert.h or cassert in a lot of places. If those ever happen to be in a file that doesn't include common.h, or we are before common.h gets included, we're unawaringly working with the system 'assert' macro again, which may get disabled for debug builds or at least has different behavior on crash. We undef 'assert' and redefine it in common.h. Those were all eliminated, except in one catch-22 spot for maybe.h: it can't include common.h. A fix might be to make a fish_assert.h that *usually* common.h exports.
46 lines
1.7 KiB
C++
46 lines
1.7 KiB
C++
// Prototypes for functions for executing a program.
|
|
#ifndef FISH_EXEC_H
|
|
#define FISH_EXEC_H
|
|
|
|
#include "config.h"
|
|
|
|
#include <csignal>
|
|
#include <memory>
|
|
|
|
#include "flog.h"
|
|
#include "io.h"
|
|
#include "proc.h"
|
|
|
|
class parser_t;
|
|
|
|
/// Execute the processes specified by \p j in the parser \p.
|
|
/// On a true return, the job was successfully launched and the parser will take responsibility for
|
|
/// 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);
|
|
|
|
/// Evaluate a command.
|
|
///
|
|
/// \param cmd the command to execute
|
|
/// \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.
|
|
///
|
|
/// \return a value appropriate for populating $status.
|
|
int exec_subshell(const wcstring &cmd, parser_t &parser, bool apply_exit_status);
|
|
int exec_subshell(const wcstring &cmd, parser_t &parser, wcstring_list_t &outputs,
|
|
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
|
|
/// halt expansion. If the \p pgid is supplied, then any spawned external commands should join that
|
|
/// pgroup.
|
|
int exec_subshell_for_expand(const wcstring &cmd, parser_t &parser,
|
|
const job_group_ref_t &job_group, wcstring_list_t &outputs);
|
|
|
|
/// Add signals that should be masked for external processes in this job.
|
|
bool blocked_signals_for_job(const job_t &job, sigset_t *sigmask);
|
|
|
|
#endif
|