macos fixes

This commit is contained in:
2025-08-05 18:43:16 -05:00
parent bea5e02c2e
commit b28496c7b6
4 changed files with 28 additions and 4 deletions

View File

@@ -456,6 +456,15 @@ auto fuse_base::mount([[maybe_unused]] std::vector<std::string> orig_args,
return -1;
}
system(fmt::format("launchctl bootout gui/{} '{}' 1>/dev/null 2>&1",
getuid(),
utils::path::combine("~",
{
"/Library/LaunchAgents",
fmt::format("{}.plist", label),
}))
.c_str());
system(fmt::format("launchctl bootstrap gui/{} '{}' 1>/dev/null 2>&1",
getuid(),
utils::path::combine("~",
@@ -464,6 +473,7 @@ auto fuse_base::mount([[maybe_unused]] std::vector<std::string> orig_args,
fmt::format("{}.plist", label),
}))
.c_str());
ret = system(
fmt::format("launchctl kickstart gui/{}/{}", getuid(), label).c_str());
if (ret != 0) {

View File

@@ -502,8 +502,6 @@ auto fuse_drive::getattr_impl(std::string api_path, struct stat *u_stat,
auto fuse_drive::getattr_impl(std::string api_path, struct stat *u_stat)
-> api_error {
#endif
auto parent = utils::path::get_parent_api_path(api_path);
auto res = check_parent_access(api_path, X_OK);
if (res != api_error::success) {
return res;

View File

@@ -19,6 +19,7 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include <utils/common.hpp>
#if !defined(_WIN32)
#include "utils/unix/unix_utils.hpp"
@@ -277,7 +278,6 @@ auto create_daemon(std::function<int()> main_func) -> int {
signal(SIGHUP, SIG_DFL);
signal(SIGPIPE, SIG_IGN);
umask(0);
chdir("/");
return main_func();
#else // !defined(__APPLE__)
@@ -297,7 +297,6 @@ auto create_daemon(std::function<int()> main_func) -> int {
return 1;
}
umask(0);
chdir("/");
return main_func();
}
@@ -333,6 +332,19 @@ auto generate_launchd_plist(const std::string &label, std::string plist_path,
array.append_child("string").text().set(arg.c_str());
}
dict.append_child("key").text().set("EnvironmentVariables");
pugi::xml_node env_dict = dict.append_child("dict");
if (not utils::get_environment_variable("PROJECT_TEST_CONFIG_DIR").empty()) {
env_dict.append_child("key").text().set("PROJECT_TEST_CONFIG_DIR");
env_dict.append_child("string").text().set(
utils::get_environment_variable("PROJECT_TEST_CONFIG_DIR"));
}
if (not utils::get_environment_variable("PROJECT_TEST_INPUT_DIR").empty()) {
env_dict.append_child("key").text().set("PROJECT_TEST_INPUT_DIR");
env_dict.append_child("string").text().set(
utils::get_environment_variable("PROJECT_TEST_INPUT_DIR"));
}
dict.append_child("key").text().set("WorkingDirectory");
dict.append_child("string").text().set(working_dir.c_str());