summaryrefslogtreecommitdiff
path: root/test/test-execute
diff options
context:
space:
mode:
authorLucas Werkmeister <mail@lucaswerkmeister.de>2021-01-14 22:32:55 +0100
committerLennart Poettering <lennart@poettering.net>2021-01-15 09:54:50 +0100
commit8d7dab1fda99a294a5538747bdb1a5960a3c2f43 (patch)
treee3e1e5c590afa651474ff2b9458cf9d6692fb5a0 /test/test-execute
parente2ebc406ac78cb57612ce5c5d590018572d71df1 (diff)
downloadsystemd-8d7dab1fda99a294a5538747bdb1a5960a3c2f43.tar.gz
Add truncate: to StandardOutput= etc.
This adds the ability to specify truncate:PATH for StandardOutput= and StandardError=, similar to the existing append:PATH. The code is mostly copied from the related append: code. Fixes #8983.
Diffstat (limited to 'test/test-execute')
-rw-r--r--test/test-execute/exec-standardoutput-truncate.service13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/test-execute/exec-standardoutput-truncate.service b/test/test-execute/exec-standardoutput-truncate.service
new file mode 100644
index 0000000000..7a12a06923
--- /dev/null
+++ b/test/test-execute/exec-standardoutput-truncate.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=Test for StandardOutput=truncate:
+
+[Service]
+ExecStartPre=sh -c 'printf "hello\n" > /tmp/test-exec-standardoutput-output'
+ExecStartPre=sh -c 'printf "hi\n" > /tmp/test-exec-standardoutput-expected'
+StandardInput=data
+StandardInputText=hi
+StandardOutput=truncate:/tmp/test-exec-standardoutput-output
+StandardError=null
+ExecStart=cat
+ExecStartPost=cmp /tmp/test-exec-standardoutput-output /tmp/test-exec-standardoutput-expected
+Type=oneshot