Skip to content

Commit 9b24716

Browse files
committed
pty check before exec
1 parent 28baf15 commit 9b24716

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

hackshell.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1714,10 +1714,12 @@ _hs_mk_pty() {
17141714
read -r
17151715
echo -e ">>> Cut & paste ${CDC} eval \"\$(curl -SsfL ${_HSURL})\"${CN}"
17161716
1717+
# Some systems no not allow pty allocation.
1718+
# => Test if PTY allocation works and call exec therafter
17171719
if [ -n "$HS_PY" ]; then
1718-
"${HS_PY:-python}" -c "import pty;" 2>/dev/null && exec "${HS_PY:-python}" -c "import pty; pty.spawn('${SHELL:-sh}')"
1720+
"${HS_PY:-python}" -c "import pty; pty.spawn(['${SHELL:-sh}', '-c' , 'true'])" 2>/dev/null && exec "${HS_PY:-python}" -c "import pty; pty.spawn('${SHELL:-sh}')"
17191721
elif command -v script >/dev/null; then
1720-
exec script -qc "${SHELL:-sh}" /dev/null
1722+
script -qc "${SHELL:-sh} -c true" /dev/null && exec script -qc "${SHELL:-sh}" /dev/null
17211723
fi
17221724
17231725
HS_ERR "Not found: python or script"

0 commit comments

Comments
 (0)