From 6663c4f8ade2f3647b20552ae3bd84ea01d4a4e1 Mon Sep 17 00:00:00 2001 From: William Chargin Date: Tue, 29 May 2018 12:20:53 -0700 Subject: [PATCH] Fix `ensure-flow.sh` running under Node (#314) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: The use of `tee /dev/stderr` failed when running as a child process under Node for some reason. (I haven’t been able to figure out why—it works fine when run as a standalone script or when run as a child process under Python.) This is also technically Linux-specific, so I’ve changed it to use a process substitution. After looking around for a bit, there doesn’t seem to be a way to do this in a way that is portable, uses only POSIX shell features, and doesn’t create temporary files all at the same time, so the script is now run under `bash`. Test Plan: Run `yarn travis` and note that the `ensure-flow.sh` output no longer contains the line `tee: /dev/stderr: No such device or address`. wchargin-branch: no-tee-devstderr --- scripts/ensure-flow.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/ensure-flow.sh b/scripts/ensure-flow.sh index 07a25cf..2745189 100755 --- a/scripts/ensure-flow.sh +++ b/scripts/ensure-flow.sh @@ -1,7 +1,7 @@ -#!/bin/sh +#!/bin/bash set -eu git grep -Fz --files-without-match -e '@flow' -e '@no-flow' -- '*.js' \ | grep -zv '^flow-typed/' \ | tr '\0' '\n' \ - | tee /dev/stderr \ + | tee >(cat >&2) \ | diff -q /dev/null - >/dev/null