-#ifdef CY_ATTACH
- if (pid == _not(pid_t))
- client_ = -1;
- else {
- struct Socket {
- int fd_;
-
- Socket(int fd) :
- fd_(fd)
- {
- }
-
- ~Socket() {
- close(fd_);
- }
-
- operator int() {
- return fd_;
- }
- } server(_syscall(socket(PF_UNIX, SOCK_STREAM, 0)));
-
- struct sockaddr_un address;
- memset(&address, 0, sizeof(address));
- address.sun_family = AF_UNIX;
-
- const char *tmp;
-#if defined(__APPLE__) && (defined(__arm__) || defined(__arm64__))
- tmp = "/Library/Caches";
-#else
- tmp = "/tmp";
-#endif
-
- sprintf(address.sun_path, "%s/.s.cy.%u", tmp, getpid());
- unlink(address.sun_path);
-
- struct File {
- const char *path_;
-
- File(const char *path) :
- path_(path)
- {
- }
-
- ~File() {
- unlink(path_);
- }
- } file(address.sun_path);
-
- _syscall(bind(server, reinterpret_cast<sockaddr *>(&address), SUN_LEN(&address)));
- _syscall(chmod(address.sun_path, 0777));
-
- _syscall(listen(server, 1));
- const char *const argv[] = {address.sun_path, NULL};
- InjectLibrary(pid, 1, argv);
- client_ = _syscall(accept(server, NULL, NULL));
- }
-#else
- client_ = -1;
+#ifdef CY_EXECUTE
+ // XXX: const_cast?! wtf gcc :(
+ CYSetArgs(argv0, script, argc, const_cast<const char **>(argv));