Use sockets in abstract namespace only if running on linux
Also adds fallback to shell client which uses `uname -o` in place of `ostype`. Closes #1215
This commit is contained in:
parent
432cc5031f
commit
aaf52c92c5
|
@ -42,12 +42,12 @@ void do_write(int sd, const char *raw, size_t len) {
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef __APPLE__
|
||||
# define ADDRESS_TEMPLATE "/tmp/powerline-ipc-%d"
|
||||
# define A
|
||||
#else
|
||||
#ifdef __linux__
|
||||
# define ADDRESS_TEMPLATE "powerline-ipc-%d"
|
||||
# define A +1
|
||||
#else
|
||||
# define ADDRESS_TEMPLATE "/tmp/powerline-ipc-%d"
|
||||
# define A
|
||||
#endif
|
||||
|
||||
#define ADDRESS_SIZE sizeof(ADDRESS_TEMPLATE) + (sizeof(uid_t) * 4)
|
||||
|
|
|
@ -26,9 +26,7 @@ if len(sys.argv) < 2:
|
|||
print('Must provide at least one argument.', file=sys.stderr)
|
||||
raise SystemExit(1)
|
||||
|
||||
platform = sys.platform.lower()
|
||||
use_filesystem = 'darwin' in platform
|
||||
del platform
|
||||
use_filesystem = not sys.platform.lower().startswith('linux')
|
||||
|
||||
if sys.argv[1] == '--socket':
|
||||
address = sys.argv[2]
|
||||
|
|
|
@ -1,6 +1,22 @@
|
|||
#!/bin/sh
|
||||
|
||||
test "${OSTYPE#darwin}" = "${OSTYPE}" && darwin=n || darwin=y
|
||||
use_filesystem=1
|
||||
darwin=
|
||||
if test -n "$OSTYPE" ; then
|
||||
# OSTYPE variable is a shell feature. supported by bash and zsh, but not
|
||||
# dash, busybox or (m)ksh.
|
||||
if test "${OSTYPE#linux}" '!=' "${OSTYPE}" ; then
|
||||
use_filesystem=
|
||||
elif test "${OSTYPE#darwin}" ; then
|
||||
darwin=1
|
||||
fi
|
||||
elif which uname >/dev/null ; then
|
||||
if uname -o | grep -iqF linux ; then
|
||||
use_filesystem=
|
||||
elif uname -o | grep -iqF darwin ; then
|
||||
darwin=1
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$1" = "--socket" ; then
|
||||
shift
|
||||
|
@ -8,13 +24,16 @@ if test "$1" = "--socket" ; then
|
|||
shift
|
||||
else
|
||||
ADDRESS="powerline-ipc-${UID:-`id -u`}"
|
||||
test "$darwin" = y && ADDRESS="/tmp/$ADDRESS"
|
||||
test -n "$use_filesystem" && ADDRESS="/tmp/$ADDRESS"
|
||||
fi
|
||||
|
||||
if test "$darwin" = y; then
|
||||
if test -n "$darwin" ; then
|
||||
ENV=genv
|
||||
else
|
||||
ENV=env
|
||||
fi
|
||||
|
||||
if test -z "$use_filesystem" ; then
|
||||
ADDRESS="abstract-client:$ADDRESS"
|
||||
fi
|
||||
|
||||
|
|
|
@ -24,8 +24,7 @@ from powerline.commands.daemon import get_argparser as get_daemon_argparser
|
|||
|
||||
|
||||
is_daemon = False
|
||||
platform = sys.platform.lower()
|
||||
use_filesystem = 'darwin' in platform
|
||||
use_filesystem = not sys.platform.lower().startswith('linux')
|
||||
|
||||
address = None
|
||||
pidfile = None
|
||||
|
|
Loading…
Reference in New Issue