Skip to content

Commit abf8461

Browse files
committed
fix(aliases/general): suppress Pico from starting the editor for the feature check
1 parent ed3e0e5 commit abf8461

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

‎aliases/general.aliases.sh‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,16 @@ function _omb_util_alias_select_nano {
6060
# also supports "-W" for a different meaning than Nano, which leads to a
6161
# problem [2]. We exclude Pico by checking if it matches "-W <wordseps>".
6262
#
63+
# In addition, we have used "nano --help" to get the help text, but it turned
64+
# out that Pico starts the text editor in the terminal with "nano --help" in
65+
# macOS, which blocks the execution of the following command. This cannot be
66+
# prevented by redirecting the standard streams. Instead, we need to use
67+
# "nano -h", which is supported by both Nano and Pico as an option to print
68+
# the help text, to safely check the support for the option.
69+
#
6370
# [1] https://github.com/ohmybash/oh-my-bash/issues/419
6471
# [2] https://github.com/ohmybash/oh-my-bash/issues/776
65-
if LANG=C command nano --help 2>/dev/null | grep '^[[:space:]]*-W' | grep -qv '^[[:space:]]*-W <wordseps>'; then
72+
if LANG=C command nano -h 2>/dev/null | grep '^[[:space:]]*-W' | grep -qv '^[[:space:]]*-W <wordseps>'; then
6673
_omb_command='nano -W'
6774
else
6875
_omb_command='nano'

0 commit comments

Comments
 (0)