macos fixes
This commit is contained in:
@@ -456,6 +456,15 @@ auto fuse_base::mount([[maybe_unused]] std::vector<std::string> orig_args,
|
|||||||
return -1;
|
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",
|
system(fmt::format("launchctl bootstrap gui/{} '{}' 1>/dev/null 2>&1",
|
||||||
getuid(),
|
getuid(),
|
||||||
utils::path::combine("~",
|
utils::path::combine("~",
|
||||||
@@ -464,6 +473,7 @@ auto fuse_base::mount([[maybe_unused]] std::vector<std::string> orig_args,
|
|||||||
fmt::format("{}.plist", label),
|
fmt::format("{}.plist", label),
|
||||||
}))
|
}))
|
||||||
.c_str());
|
.c_str());
|
||||||
|
|
||||||
ret = system(
|
ret = system(
|
||||||
fmt::format("launchctl kickstart gui/{}/{}", getuid(), label).c_str());
|
fmt::format("launchctl kickstart gui/{}/{}", getuid(), label).c_str());
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
|
@@ -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)
|
auto fuse_drive::getattr_impl(std::string api_path, struct stat *u_stat)
|
||||||
-> api_error {
|
-> api_error {
|
||||||
#endif
|
#endif
|
||||||
auto parent = utils::path::get_parent_api_path(api_path);
|
|
||||||
|
|
||||||
auto res = check_parent_access(api_path, X_OK);
|
auto res = check_parent_access(api_path, X_OK);
|
||||||
if (res != api_error::success) {
|
if (res != api_error::success) {
|
||||||
return res;
|
return res;
|
||||||
|
@@ -19,6 +19,7 @@
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
#include <utils/common.hpp>
|
||||||
#if !defined(_WIN32)
|
#if !defined(_WIN32)
|
||||||
|
|
||||||
#include "utils/unix/unix_utils.hpp"
|
#include "utils/unix/unix_utils.hpp"
|
||||||
@@ -277,7 +278,6 @@ auto create_daemon(std::function<int()> main_func) -> int {
|
|||||||
signal(SIGHUP, SIG_DFL);
|
signal(SIGHUP, SIG_DFL);
|
||||||
signal(SIGPIPE, SIG_IGN);
|
signal(SIGPIPE, SIG_IGN);
|
||||||
|
|
||||||
umask(0);
|
|
||||||
chdir("/");
|
chdir("/");
|
||||||
return main_func();
|
return main_func();
|
||||||
#else // !defined(__APPLE__)
|
#else // !defined(__APPLE__)
|
||||||
@@ -297,7 +297,6 @@ auto create_daemon(std::function<int()> main_func) -> int {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
umask(0);
|
|
||||||
chdir("/");
|
chdir("/");
|
||||||
return main_func();
|
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());
|
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("key").text().set("WorkingDirectory");
|
||||||
dict.append_child("string").text().set(working_dir.c_str());
|
dict.append_child("string").text().set(working_dir.c_str());
|
||||||
|
|
||||||
|
@@ -349,6 +349,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void execute_mount(auto args, auto location) {
|
static void execute_mount(auto args, auto location) {
|
||||||
|
EXPECT_TRUE(utils::file::change_to_process_directory());
|
||||||
|
|
||||||
args.emplace_back(location);
|
args.emplace_back(location);
|
||||||
auto mount_cmd = "./repertory " + utils::string::join(args, ' ');
|
auto mount_cmd = "./repertory " + utils::string::join(args, ' ');
|
||||||
std::cout << "mount command: " << mount_cmd << std::endl;
|
std::cout << "mount command: " << mount_cmd << std::endl;
|
||||||
@@ -359,6 +361,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void execute_unmount(auto args) {
|
static void execute_unmount(auto args) {
|
||||||
|
EXPECT_TRUE(utils::file::change_to_process_directory());
|
||||||
|
|
||||||
args.emplace_back("-unmount");
|
args.emplace_back("-unmount");
|
||||||
auto unmount_cmd = "./repertory " + utils::string::join(args, ' ');
|
auto unmount_cmd = "./repertory " + utils::string::join(args, ' ');
|
||||||
std::cout << "unmount command: " << unmount_cmd << std::endl;
|
std::cout << "unmount command: " << unmount_cmd << std::endl;
|
||||||
|
Reference in New Issue
Block a user