Skip to content

Commit 5e52ade

Browse files
authored
disable process functions on iOS (#1173)
1 parent c927bcd commit 5e52ade

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/lib/fcitx-utils/misc.cpp

+20
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,22 @@
2121
#include <sys/user.h>
2222
#endif
2323
#elif defined(__APPLE__)
24+
#include <TargetConditionals.h>
25+
#if TARGET_OS_OSX
2426
#include <libproc.h>
2527
#endif
28+
#endif
2629

2730
namespace fcitx {
2831

2932
void startProcess(const std::vector<std::string> &args,
3033
const std::string &workingDirectory) {
34+
#if defined(__APPLE__) && TARGET_OS_IPHONE
35+
FCITX_UNUSED(args);
36+
FCITX_UNUSED(workingDirectory);
37+
FCITX_ERROR() << "Not implemented";
38+
return;
39+
#else
3140
/* exec command */
3241
pid_t child_pid;
3342

@@ -67,6 +76,7 @@ void startProcess(const std::vector<std::string> &args,
6776
int status;
6877
waitpid(child_pid, &status, 0);
6978
}
79+
#endif
7080
}
7181

7282
std::string getProcessName(pid_t pid) {
@@ -111,13 +121,19 @@ std::string getProcessName(pid_t pid) {
111121
kvm_close(vm);
112122
return result;
113123
#elif defined(__APPLE__)
124+
#if TARGET_OS_IPHONE
125+
FCITX_UNUSED(pid);
126+
FCITX_ERROR() << "Not implemented";
127+
return "";
128+
#else
114129
std::string result;
115130
result.reserve(2 * MAXCOMLEN);
116131

117132
if (proc_name(pid, result.data(), 2 * MAXCOMLEN)) {
118133
return {};
119134
}
120135
return result;
136+
#endif
121137
#else
122138
auto path = fmt::format("/proc/{}/exe", pid);
123139
if (auto link = fs::readlink(path)) {
@@ -135,13 +151,17 @@ ssize_t getline(UniqueCPtr<char> &lineptr, size_t *n, std::FILE *stream) {
135151
}
136152

137153
bool isInFlatpak() {
154+
#ifdef __APPLE__
155+
return false;
156+
#else
138157
static const bool flatpak = []() {
139158
if (checkBoolEnvVar("FCITX_OVERRIDE_FLATPAK")) {
140159
return true;
141160
}
142161
return fs::isreg("/.flatpak-info");
143162
}();
144163
return flatpak;
164+
#endif
145165
}
146166

147167
} // namespace fcitx

0 commit comments

Comments
 (0)