Selaa lähdekoodia

test for output on stdout and disable socat as this is broken for non-sudo wrapped because of direct write to pty

Daniel Sheffield 2 kuukautta sitten
vanhempi
sitoutus
d220fb225e
2 muutettua tiedostoa jossa 5 lisäystä ja 3 poistoa
  1. 1 1
      capture.sh
  2. 4 2
      tests/test.sh

+ 1 - 1
capture.sh

@@ -38,7 +38,7 @@ EOF
 trap 'info' EXIT
 
 exec 2> >(tee -a "$DAT" "$ERR")
-if which socat 1>/dev/null 2>&1 && ! [ "$PROG" = "sudo" ]
+if which socat 1>/dev/null 2>&1 && false && ! [ "$PROG" = "sudo" ]
 then
 	tty="$(tty)"
 	socat PTY,rawer,link="$PTY" EXEC:"$(shell_escape tee -a "$DAT" "$OUT" "$tty")" &

+ 4 - 2
tests/test.sh

@@ -61,7 +61,8 @@ export RECALL_FZF_ENABLE RECALL_VIPE_ENABLE RECALL_ISELECT_ENABLE
 
 ( TEST_CASE "Capture : ls"
 	CMD=(ls -lah capture-ls-data)
-	+ "${CMD[@]}"
+	OUT="$(+ "${CMD[@]}")"
+	[ "$OUT" = "$("${CMD[@]}")" ]
 	[ "$(@ ls)" = "$("${CMD[@]}")" ]
 	[ "$(@ -ln1 ls)" = "$(readlink -e "$LOG_ROOT"/ls/*)" ]
 	[ "$(@ -sln1 ls)" = "${CMD[*]}" ]
@@ -70,7 +71,8 @@ export RECALL_FZF_ENABLE RECALL_VIPE_ENABLE RECALL_ISELECT_ENABLE
 ( TEST_CASE "Capture : sudo ls"
 
 	CMD=(sudo ls -lah capture-ls-data)
-	+ "${CMD[@]}"
+	OUT="$(+ "${CMD[@]}")"
+	[ "$OUT" = "$("${CMD[@]}")" ]
 	[ "$(@ sudo ls)" = "$("${CMD[@]}")" ]
 	[ "$(@ -ln1 sudo ls)" = "$(readlink -e "$LOG_ROOT"/sudo/ls/*)" ]
 	[ "$(@ -ln1 ls)" = "$(readlink -e "$LOG_ROOT"/sudo/ls/*)" ]