Skip to content

Commit

Permalink
Merge pull request #35 from balena-io-experimental/kyle/stderr-redire…
Browse files Browse the repository at this point in the history
…ction

Create /dev/fd symlink so anonymous pipes can be created
  • Loading branch information
flowzone-app[bot] authored Nov 16, 2023
2 parents 4e78146 + 91bfde1 commit a3eca09
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
3 changes: 3 additions & 0 deletions overlay/sbin/init
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 10 additions & 3 deletions test/healthcheck.sh
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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)"
Expand Down

0 comments on commit a3eca09

Please sign in to comment.