From 3c4c916fd04d74e4032289d2861aa8fd99faebe3 Mon Sep 17 00:00:00 2001 From: Kyle Harding Date: Wed, 15 Nov 2023 11:26:32 -0500 Subject: [PATCH 1/2] Test redirection of stdout and stderr Change-type: patch Signed-off-by: Kyle Harding --- test/healthcheck.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/test/healthcheck.sh b/test/healthcheck.sh index ede2a39..35a3f79 100644 --- a/test/healthcheck.sh +++ b/test/healthcheck.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env bash # This script is run as the healthcheck command for the VM image and # the logs are grepped for the exit status message to determine success/fail. @@ -21,8 +21,15 @@ uname -a df -h -echo "Hello, World!" >/dev/stdout -echo "Hello, World!" >/dev/stderr +ls -al /dev/ + +echo "Testing stdout" >&1 +echo "Testing stderr" >&2 +echo "Testing stdout" >/dev/stdout +echo "Testing stderr" >/dev/stderr + +echo "Testing stdout" 1> >(tee /tmp/stdout) +echo "Testing stderr" 2> >(tee /tmp/stderr) if [ -n "${HOSTNAME}" ]; then test "${HOSTNAME}" = "$(hostname)" From 91bfde1a56e261157ba0252fdded8d04d485ff36 Mon Sep 17 00:00:00 2001 From: Kyle Harding Date: Wed, 15 Nov 2023 13:54:04 -0500 Subject: [PATCH 2/2] Create /dev/fd symlink so anonymous pipes can be created In order to support process substitution and anonymous pipes we need to ensure the /dev/fd path exists. Change-type: patch Signed-off-by: Kyle Harding --- overlay/sbin/init | 3 +++ 1 file changed, 3 insertions(+) diff --git a/overlay/sbin/init b/overlay/sbin/init index 4190822..1dbe3b9 100644 --- a/overlay/sbin/init +++ b/overlay/sbin/init @@ -6,6 +6,9 @@ exec 2>/dev/console chown root:tty /dev/console chmod 622 /dev/console +# create symlink to /proc/self/fd +ln -s /proc/self/fd /dev/fd + ln -s /proc/self/fd/0 /dev/stdin ln -s /proc/self/fd/1 /dev/stdout ln -s /proc/self/fd/2 /dev/stderr