mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-23 10:43:32 +08:00
Remove problems with fishd under Cygwin.
Yes, it's an awful hack, but IPC support (and fork support as well - even FAQ mentions that, and suggests "restarting process" to solve the problem (http://cygwin.com/faq/faq.html#faq.using.fixing-fork-failures), but let's ignore that for now) is simply broken in Cygwin. Having to try to do exactly same thing in Cygwin, just so perhaps it will work is a completely normal thing (not). I love Windows.
This commit is contained in:
parent
e5e7da1482
commit
d7c6855918
12
fishd.cpp
12
fishd.cpp
|
@ -529,6 +529,14 @@ static bool acquire_socket_lock(const std::string &sock_name, std::string *out_l
|
|||
*/
|
||||
static int get_socket(void)
|
||||
{
|
||||
// Cygwin has random problems involving sockets. When using Cygwin,
|
||||
// allow 20 attempts at making socket correctly.
|
||||
#ifdef __CYGWIN__
|
||||
int attempts = 0;
|
||||
repeat:
|
||||
attempts += 1;
|
||||
#endif
|
||||
|
||||
int s, len, doexit = 0;
|
||||
int exitcode = EXIT_FAILURE;
|
||||
struct sockaddr_un local;
|
||||
|
@ -599,6 +607,10 @@ unlock:
|
|||
|
||||
if (doexit)
|
||||
{
|
||||
// If Cygwin, only allow normal quit when made lots of attempts.
|
||||
#ifdef __CYGWIN__
|
||||
if (exitcode && attempts < 20) goto repeat;
|
||||
#endif
|
||||
exit_without_destructors(exitcode);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user