diff options
author | Lars Wirzenius <liw@liw.fi> | 2021-02-18 09:27:25 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2021-02-19 19:58:31 +0200 |
commit | 248e5ab7518746c0ac43747040290e9b5d138028 (patch) | |
tree | fead573f0f298758c913d01566de9edc682ebf22 /subplot | |
parent | 45f4145573035a6485f565cacf16c6a39c36dbd5 (diff) | |
download | obnam2-248e5ab7518746c0ac43747040290e9b5d138028.tar.gz |
feat: back up and restore Unix domain sockets
Diffstat (limited to 'subplot')
-rw-r--r-- | subplot/data.py | 6 | ||||
-rw-r--r-- | subplot/data.yaml | 3 |
2 files changed, 9 insertions, 0 deletions
diff --git a/subplot/data.py b/subplot/data.py index f7fb903..3c369d1 100644 --- a/subplot/data.py +++ b/subplot/data.py @@ -2,6 +2,7 @@ import json import logging import os import random +import socket import yaml @@ -18,6 +19,11 @@ def create_file_with_random_data(ctx, filename=None): create_file_with_given_data(ctx, filename=filename, data=data) +def create_unix_socket(ctx, filename=None): + fd = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) + fd.bind(filename) + + def create_nonutf8_filename(ctx, dirname=None): filename = "\x88" os.mkdir(dirname) diff --git a/subplot/data.yaml b/subplot/data.yaml index 1636e77..97e6eed 100644 --- a/subplot/data.yaml +++ b/subplot/data.yaml @@ -4,6 +4,9 @@ - given: "a file {filename} containing some random data" function: create_file_with_random_data +- given: "a Unix socket {filename}" + function: create_unix_socket + - given: "a file in {dirname} with a non-UTF8 filename" function: create_nonutf8_filename |