summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2021-02-18 10:25:16 +0200
committerLars Wirzenius <liw@liw.fi>2021-02-18 10:25:16 +0200
commit73e89dd7760b6f37be3b8a6d110d12633bbbf651 (patch)
tree063fe6a0389aff06d579e8ccc7b1e880600279fc
parent24f26b26d0ee56f0d61ce083ad88c02bfa5f72d2 (diff)
downloadsummain-rs-73e89dd7760b6f37be3b8a6d110d12633bbbf651.tar.gz
feat: support named pipes (FIFOs)
-rw-r--r--subplot/summain.py4
-rw-r--r--subplot/summain.yaml3
-rw-r--r--summain.md23
3 files changed, 30 insertions, 0 deletions
diff --git a/subplot/summain.py b/subplot/summain.py
index e137ade..ca7c0f6 100644
--- a/subplot/summain.py
+++ b/subplot/summain.py
@@ -28,6 +28,10 @@ def create_socket(ctx, filename=None):
fd.bind(filename)
+def create_fifo(ctx, filename=None):
+ os.mkfifo(filename)
+
+
def set_mode(ctx, filename=None, mode=None):
os.chmod(filename, int(mode, 8))
diff --git a/subplot/summain.yaml b/subplot/summain.yaml
index 8df3642..8e5333c 100644
--- a/subplot/summain.yaml
+++ b/subplot/summain.yaml
@@ -7,6 +7,9 @@
- given: socket {filename}
function: create_socket
+- given: named pipe {filename}
+ function: create_fifo
+
- given: file {filename}
function: create_file
diff --git a/summain.md b/summain.md
index 1631622..df2087e 100644
--- a/summain.md
+++ b/summain.md
@@ -226,6 +226,29 @@ sha256: ~
target: ~
```
+## Named pipe
+
+~~~scenario
+given an installed summain
+given named pipe aaa
+and file aaa has mode 0700
+and mtime for aaa is 44
+when I run summain aaa
+then output matches file fifo.yaml
+~~~
+
+```{#fifo.yaml .file .numberLines}
+---
+path: aaa
+mode: prwx------
+mtime: 44
+mtime_nsec: 0
+nlink: 1
+size: 0
+sha256: ~
+target: ~
+```
+
---
title: "Summain&mdash;deterministic file manifests"
author: Lars Wirzenius