summaryrefslogtreecommitdiff
path: root/tests/misc/cat-buf.sh
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2015-07-04 17:13:50 +0300
committerIgor Pashev <pashev.igor@gmail.com>2015-07-04 17:13:50 +0300
commit71cd8e3a743046573744123777061b64881bf372 (patch)
tree82522befe647f4fff186a5630cad0cad33f8ef53 /tests/misc/cat-buf.sh
parentc18578632fd3c9e513e613a86ba2b7c4ebee6c45 (diff)
downloadcoreutils-upstream.tar.gz
Imported Upstream version 8.24upstream/8.24upstream
Diffstat (limited to 'tests/misc/cat-buf.sh')
-rwxr-xr-xtests/misc/cat-buf.sh8
1 files changed, 5 insertions, 3 deletions
diff --git a/tests/misc/cat-buf.sh b/tests/misc/cat-buf.sh
index 592b5a1d..31382481 100755
--- a/tests/misc/cat-buf.sh
+++ b/tests/misc/cat-buf.sh
@@ -1,7 +1,7 @@
#!/bin/sh
# Ensure that cat outputs processed data immediately.
-# Copyright (C) 2009-2014 Free Software Foundation, Inc.
+# Copyright (C) 2009-2015 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,6 +26,8 @@ print_ver_ cat
# write separately.
mkfifo_or_skip_ fifo
+# Terminate any background cp process
+cleanup_() { kill $pid 2>/dev/null && wait $pid; }
echo 1 > exp
@@ -33,9 +35,9 @@ cat_buf_1()
{
local delay="$1"
- dd count=1 if=fifo > out &
+ dd count=1 if=fifo > out & pid=$!
(echo 1; sleep $delay; echo 2) | cat -v > fifo
- wait # for dd to complete
+ wait $pid
compare exp out
}