From 90855d4d8929b97e4d894735939fdb439a1d81b0 Mon Sep 17 00:00:00 2001 From: Alexei Sorokin Date: Fri, 9 Jun 2017 10:42:32 +0300 Subject: [PATCH] Stop importing subprocess --- hptoad.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/hptoad.py b/hptoad.py index 072a277..0fae062 100755 --- a/hptoad.py +++ b/hptoad.py @@ -5,7 +5,6 @@ import logging import os import re import signal -import subprocess import sys import time import slixmpp @@ -132,12 +131,12 @@ class Hptoad: return reply, err try: - proc = yield from \ - asyncio.create_subprocess_exec(*cmd, - stdout=subprocess.PIPE, - stderr=subprocess.PIPE) + pipe = asyncio.subprocess.PIPE + proc = yield from asyncio.create_subprocess_exec(*cmd, + stdout=pipe, + stderr=pipe) cmd_reply, cmd_err = yield from proc.communicate() - except subprocess.CalledProcessError as e: + except OSError as e: reply = "%s: WAT" % nick err = "Execute: %s" % str(e) return reply, err