2023-02-11 20:31:08 +00:00
|
|
|
// event.h and event.cpp only contain cpp-side ffi compat code to make event.rs.h a drop-in
|
|
|
|
// replacement. There is no logic still in here that needs to be ported to rust.
|
|
|
|
|
2016-05-18 22:30:21 +00:00
|
|
|
#include "config.h" // IWYU pragma: keep
|
|
|
|
|
2019-10-13 22:50:48 +00:00
|
|
|
#include "event.h"
|
|
|
|
|
2016-04-29 02:19:50 +00:00
|
|
|
#include <signal.h>
|
2016-04-21 06:00:54 +00:00
|
|
|
#include <unistd.h>
|
2017-02-11 02:47:02 +00:00
|
|
|
|
2016-04-21 06:00:54 +00:00
|
|
|
#include <algorithm>
|
2022-05-28 20:35:17 +00:00
|
|
|
#include <array>
|
2019-02-21 03:36:29 +00:00
|
|
|
#include <atomic>
|
2022-08-21 06:14:48 +00:00
|
|
|
#include <bitset>
|
2016-04-29 02:19:50 +00:00
|
|
|
#include <memory>
|
2015-07-25 15:14:25 +00:00
|
|
|
#include <string>
|
2023-02-10 17:19:22 +00:00
|
|
|
#include <utility>
|
2005-10-05 22:37:08 +00:00
|
|
|
|
|
|
|
#include "common.h"
|
2016-04-29 02:19:50 +00:00
|
|
|
#include "fallback.h" // IWYU pragma: keep
|
2022-08-21 06:14:48 +00:00
|
|
|
#include "flog.h"
|
2015-07-25 15:14:25 +00:00
|
|
|
#include "io.h"
|
2022-08-21 06:14:48 +00:00
|
|
|
#include "maybe.h"
|
2016-04-29 02:19:50 +00:00
|
|
|
#include "parser.h"
|
|
|
|
#include "proc.h"
|
2023-01-14 22:56:24 +00:00
|
|
|
#include "signals.h"
|
2021-04-14 15:17:22 +00:00
|
|
|
#include "termsize.h"
|
2021-05-17 22:33:33 +00:00
|
|
|
#include "wcstringutil.h"
|
2016-04-29 02:19:50 +00:00
|
|
|
#include "wutil.h" // IWYU pragma: keep
|
2006-07-19 22:55:49 +00:00
|
|
|
|
2023-02-11 20:31:08 +00:00
|
|
|
// TODO: Remove after porting functions.cpp to rust
|
2021-05-19 18:29:03 +00:00
|
|
|
const wchar_t *const event_filter_names[] = {L"signal", L"variable", L"exit",
|
|
|
|
L"process-exit", L"job-exit", L"caller-exit",
|
|
|
|
L"generic", nullptr};
|
|
|
|
|
2023-04-18 22:19:10 +00:00
|
|
|
void event_fire_generic(parser_t &parser, const wcstring &name, const std::vector<wcstring> &args) {
|
2023-02-11 20:31:08 +00:00
|
|
|
std::vector<wcharz_t> ffi_args;
|
|
|
|
for (const auto &arg : args) ffi_args.push_back(arg.c_str());
|
|
|
|
event_fire_generic_ffi(parser, name, ffi_args);
|
2021-05-17 22:33:33 +00:00
|
|
|
}
|