aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/test/os_SUITE_data
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2016-09-02 14:29:26 +0200
committerLukas Larsson <[email protected]>2016-09-02 16:34:56 +0200
commitc0ed19c1261ee281d3c8f36ec3f28fa7328f0f39 (patch)
treec0bc86162e6a429289245b0da5cfc0901f9ebfbf /lib/kernel/test/os_SUITE_data
parent71894a879d6254693791585246ce340dd7414b82 (diff)
downloadotp-c0ed19c1261ee281d3c8f36ec3f28fa7328f0f39.tar.gz
otp-c0ed19c1261ee281d3c8f36ec3f28fa7328f0f39.tar.bz2
otp-c0ed19c1261ee281d3c8f36ec3f28fa7328f0f39.zip
kernel: Close stdin of commands run in os:cmd
This is needed when running programs that only exit when stdin has been closed, e.g. 'more'.
Diffstat (limited to 'lib/kernel/test/os_SUITE_data')
-rw-r--r--lib/kernel/test/os_SUITE_data/Makefile.src8
-rw-r--r--lib/kernel/test/os_SUITE_data/my_fds.c9
2 files changed, 16 insertions, 1 deletions
diff --git a/lib/kernel/test/os_SUITE_data/Makefile.src b/lib/kernel/test/os_SUITE_data/Makefile.src
index 912d0cbcb1..f83f781411 100644
--- a/lib/kernel/test/os_SUITE_data/Makefile.src
+++ b/lib/kernel/test/os_SUITE_data/Makefile.src
@@ -3,7 +3,7 @@ LD = @LD@
CFLAGS = @CFLAGS@ -I@erl_include@ @DEFS@
CROSSLDFLAGS = @CROSSLDFLAGS@
-PROGS = my_echo@exe@
+PROGS = my_echo@exe@ my_fds@exe@
all: $(PROGS)
@@ -12,3 +12,9 @@ my_echo@exe@: my_echo@obj@
my_echo@obj@: my_echo.c
$(CC) -c -o my_echo@obj@ $(CFLAGS) my_echo.c
+
+my_fds@exe@: my_fds@obj@
+ $(LD) $(CROSSLDFLAGS) -o my_fds my_fds@obj@ @LIBS@
+
+my_fds@obj@: my_fds.c
+ $(CC) -c -o my_fds@obj@ $(CFLAGS) my_fds.c
diff --git a/lib/kernel/test/os_SUITE_data/my_fds.c b/lib/kernel/test/os_SUITE_data/my_fds.c
new file mode 100644
index 0000000000..704a4d1e1d
--- /dev/null
+++ b/lib/kernel/test/os_SUITE_data/my_fds.c
@@ -0,0 +1,9 @@
+#include <stdio.h>
+
+int
+main(int argc, char** argv)
+{
+ char buff[1];
+ int res = read(stdin, buff, 1);
+ printf("%d", res);
+}