-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Read all data on standard input (no more limit at 1MB)
- Loading branch information
Showing
1 changed file
with
10 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,13 +43,10 @@ | |
# commits_version | bar | commits by tag/version | git tag | ||
# files_type | pie | files by type (extension) | - | ||
# | ||
# 2013-03-15, Sebastien Helleu <[email protected]>: | ||
# version 0.1: initial release | ||
# | ||
|
||
import pygal, os, re, select, subprocess, sys, traceback | ||
|
||
VERSION = '0.1' | ||
VERSION = '0.2' | ||
|
||
class GitChart: | ||
"""Generate a git stat chart.""" | ||
|
@@ -291,10 +288,15 @@ def generate(self, name, title, repository, output, in_data=None): | |
sys.exit(1) | ||
|
||
# read data on standard input | ||
in_data = None | ||
inr, outr, exceptr = select.select([sys.stdin], [], [], 0) | ||
if inr: | ||
in_data = os.read(sys.stdin.fileno(), 1024 * 1024) # read max 1MB | ||
in_data = '' | ||
while True: | ||
inr, outr, exceptr = select.select([sys.stdin], [], [], 0) | ||
if not inr: | ||
break | ||
data = os.read(sys.stdin.fileno(), 4096) | ||
if not data: | ||
break | ||
in_data += data.decode('utf-8') | ||
|
||
if not chart.generate(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4], in_data=in_data): | ||
print('Failed to generate chart: %s' % sys.argv) |