Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP3:GA
llvm4.8721
llvm-lit-Make-util.executeCommand-python3-frien...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File llvm-lit-Make-util.executeCommand-python3-friendly.patch of Package llvm4.8721
From 38777f9b2662fb2b24c58345c440d80ae4e5f810 Mon Sep 17 00:00:00 2001 From: Eric Fiselier <eric@efcs.ca> Date: Wed, 18 Jan 2017 00:12:41 +0000 Subject: [PATCH] [LIT] Make util.executeCommand python3 friendly Summary: The parameter `input` to `subprocess.Popen.communicate(...)` must be an object of type `bytes` . This is strictly enforced in python3. This patch (1) allows `to_bytes` to be safely called redundantly. (2) Explicitly convert `input` within `executeCommand`. This allows for usages like `executeCommand(['clang++', '-'], input='int main() {}\n')`. Reviewers: ddunbar, BinaryKhaos, modocache, dim, EricWF Reviewed By: EricWF Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D28736 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@292308 91177308-0d34-0410-b5e6-96231b3b80d8 --- utils/lit/lit/util.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/utils/lit/lit/util.py b/utils/lit/lit/util.py index be37998c6f1..104e9dac464 100644 --- a/utils/lit/lit/util.py +++ b/utils/lit/lit/util.py @@ -10,6 +10,8 @@ import threading def to_bytes(str): # Encode to UTF-8 to get binary data. + if isinstance(str, bytes): + return str return str.encode('utf-8') def to_string(bytes): @@ -200,6 +202,8 @@ def executeCommand(command, cwd=None, env=None, input=None, timeout=0): If the timeout is hit an ``ExecuteCommandTimeoutException`` is raised. """ + if input is not None: + input = to_bytes(input) p = subprocess.Popen(command, cwd=cwd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, -- 2.13.6
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor