Received: from out1.migadu.com (out1.migadu.com [91.121.223.63]) by nld3-dev1.alpinelinux.org (Postfix) with ESMTPS id 3DCB2781874 for <~alpine/aports@lists.alpinelinux.org>; Sat, 10 Oct 2020 13:59:45 +0000 (UTC) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=misterbanal.net; s=default; t=1602338383; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=X6jMfHb+ZjrEw8jM8vvyqmPNMimy2z/tmA0VZfjar+s=; b=LVdhJCGCUu03LEBH7xH8l0DTuK2o8uSlnOkhEiqxoMEYZ2Vsht6DdR4nOBog8IeTDq72Uh iEpGhlNTQZQEtzIve3dOL0ZVVmpU8Z4VbGxQImGxilLkexzvxnyVAI72y1HUU8Il0o6+jW +yRoHdgXgweZZDIyYwPgsW83+/7sLAo= From: Reed Wade To: ~alpine/aports@lists.alpinelinux.org Subject: [PATCH sxmo-utils v5 1/8] Do not prevent interactive editors to write messages Date: Sat, 10 Oct 2020 15:59:28 +0200 Message-Id: <20201010135935.19235-1-reedwade@misterbanal.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: 4.90 We run EDITOR in a subshell and that prevent some editors as kakoune : Fatal error: stdout is not a tty This refactorise a little bit editmsg logic to not run EDITOR in a subshell and allow those editors to work. Signed-off-by: Reed Wade --- scripts/modem/sxmo_modemtext.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) Rebased works. I expect it to be mergeable now ! diff --git a/scripts/modem/sxmo_modemtext.sh b/scripts/modem/sxmo_modemtext.sh index 61ca43d..2551dec 100755 --- a/scripts/modem/sxmo_modemtext.sh +++ b/scripts/modem/sxmo_modemtext.sh @@ -22,14 +22,12 @@ modem_n() { } editmsg() { - TMP="$(mktemp --suffix "$1_msg")" - echo "$2" > "$TMP" + TMP="$1" if [ "$TERMMODE" != "true" ]; then st -e "$EDITOR" "$TMP" else "$EDITOR" "$TMP" fi - cat "$TMP" } sendtextmenu() { @@ -47,7 +45,10 @@ sendtextmenu() { echo "$NUMBER" | grep -qE '^[+0-9]+$' || err "That doesn't seem like a valid number" # Compose first version of msg - TEXT="$(editmsg "$NUMBER" 'Enter text message here')" + TMP="$(mktemp --suffix "${NUMBER}_msg")" + echo 'Enter text message here' > "$TMP" + editmsg "$TMP" + TEXT="$(cat "$TMP")" while true do @@ -57,7 +58,7 @@ sendtextmenu() { )" echo "$CONFIRM" | grep -E "^Send" && (echo "$TEXT" | sxmo_modemsendsms.sh "$NUMBER" -) && exit 0 echo "$CONFIRM" | grep -E "^Cancel$" && exit 1 - echo "$CONFIRM" | grep -E "^Edit Message" && TEXT="$(editmsg "$NUMBER" "$TEXT")" + echo "$CONFIRM" | grep -E "^Edit Message" && editmsg "$TMP" && TEXT="$(cat "$TMP")" done } -- 2.28.0