From d3aa656e5c677b1fd25ad1bdf462e329bec39bdb Mon Sep 17 00:00:00 2001 From: loader Date: Fri, 31 Jul 2015 07:59:18 +0000 Subject: [PATCH] FreeBSD crontab(1) needs a "-" to read from stdin --- bench/utils.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bench/utils.py b/bench/utils.py index ed7a9730..d0a3f3ab 100644 --- a/bench/utils.py +++ b/bench/utils.py @@ -7,6 +7,7 @@ import logging import itertools import requests import json +import platform import multiprocessing from distutils.spawn import find_executable import pwd, grp @@ -167,7 +168,10 @@ def setup_backups(bench='.'): def add_to_crontab(line): current_crontab = read_crontab() if not line in current_crontab: - s = subprocess.Popen("crontab", stdin=subprocess.PIPE) + cmd = ["crontab"] + if platform.system() == 'FreeBSD': + cmd = ["crontab", "-"] + s = subprocess.Popen(cmd, stdin=subprocess.PIPE) s.stdin.write(current_crontab) s.stdin.write(line + '\n') s.stdin.close()