Skip to content

Commit

Permalink
Prefer socat when available on Windows.
Browse files Browse the repository at this point in the history
refs gh-298
  • Loading branch information
xwmx committed Jan 26, 2024
1 parent 3cc6453 commit e572155
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions nb
Original file line number Diff line number Diff line change
Expand Up @@ -9850,26 +9850,23 @@ _main "${_ARGUMENTS[@]:-}"
export NB_BROWSE_SERVER_TOOL="${NB_BROWSE_SERVER_TOOL:-}"

__set_browse_server_tool() {
if [[ -z "${NB_BROWSE_SERVER_TOOL:-}" ]]
if [[ -z "${NB_BROWSE_SERVER_TOOL:-}" ]]
then
if _command_exists "env"
then # posix
if _command_exists "ncat"
then
NB_BROWSE_SERVER_TOOL="ncat"
elif _command_exists "socat"
then
NB_BROWSE_SERVER_TOOL="socat"
fi
elif ! _command_exists "env"
then # non-posix
if [[ "${OSTYPE}" =~ cygwin|msys|win32 ]]
then
if _command_exists "socat"
then
NB_BROWSE_SERVER_TOOL="socat"
elif _command_exists "ncat"
then
NB_BROWSE_SERVER_TOOL="ncat"
fi
elif _command_exists "ncat"
then
NB_BROWSE_SERVER_TOOL="ncat"
elif _command_exists "socat"
then
NB_BROWSE_SERVER_TOOL="socat"
elif _command_exists "nc" && nc --help &>/dev/null
then # GNU nc / netcat is present
NB_BROWSE_SERVER_TOOL="nc"
Expand Down

0 comments on commit e572155

Please sign in to comment.