Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pykat
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sean Leavey
pykat
Commits
5df83b5f
Commit
5df83b5f
authored
10 years ago
by
Daniel Brown
Browse files
Options
Downloads
Patches
Plain Diff
fixing ANSI code issue in stderr reading
parent
f6658e06
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
pykat/finesse.py
+12
-11
12 additions, 11 deletions
pykat/finesse.py
with
12 additions
and
11 deletions
pykat/finesse.py
+
12
−
11
View file @
5df83b5f
...
@@ -38,6 +38,8 @@ import itertools
...
@@ -38,6 +38,8 @@ import itertools
import
ctypes
import
ctypes
import
ctypes.util
import
ctypes.util
import
collections
import
collections
import
re
from
collections
import
namedtuple
,
OrderedDict
from
collections
import
namedtuple
,
OrderedDict
from
pykat.node_network
import
NodeNetwork
from
pykat.node_network
import
NodeNetwork
...
@@ -881,17 +883,18 @@ class kat(object):
...
@@ -881,17 +883,18 @@ class kat(object):
err
=
""
err
=
""
#if self.verbose: print "Finesse output:"
#if self.verbose: print "Finesse output:"
for
line
in
iter
(
p
.
stderr
.
readline
,
""
):
for
line
in
iter
(
p
.
stderr
.
readline
,
""
):
if
len
(
line
)
>
0
:
if
len
(
line
)
>
0
:
if
isinstance
(
line
,
unicode
):
# remove any ANSI commands
import
unicodedata
ansi
=
re
.
compile
(
r
'
\x1b[^m]*m
'
)
line
=
unicodedata
.
normalize
(
'
NFKD
'
,
line
).
encode
(
"
ascii
"
,
"
ignore
"
)
line
=
ansi
.
sub
(
''
,
line
)
if
line
.
lstrip
().
startswith
(
'
**
'
):
# warnings and errors start with an asterisk
# so if verbose show them
if
line
.
lstrip
().
startswith
(
'
*
'
):
if
self
.
verbose
:
sys
.
stdout
.
write
(
line
)
if
self
.
verbose
:
sys
.
stdout
.
write
(
line
)
elif
line
.
rstrip
().
endswith
(
'
s
'
):
elif
line
.
rstrip
().
endswith
(
'
s
'
)
and
line
.
contains
(
'
%
'
):
vals
=
line
.
split
(
"
-
"
)
vals
=
line
.
split
(
"
-
"
)
action
=
vals
[
0
].
strip
()
action
=
vals
[
0
].
strip
()
prc
=
vals
[
1
].
strip
()[:]
prc
=
vals
[
1
].
strip
()[:]
...
@@ -907,8 +910,6 @@ class kat(object):
...
@@ -907,8 +910,6 @@ class kat(object):
if
printerr
==
1
:
if
printerr
==
1
:
sys
.
stdout
.
write
(
"
\r
{0} {1}
"
.
format
(
action
,
prc
))
sys
.
stdout
.
write
(
"
\r
{0} {1}
"
.
format
(
action
,
prc
))
elif
line
[
0
:
3
]
==
'
**
'
:
if
self
.
verbose
:
sys
.
stdout
.
write
(
line
)
else
:
else
:
err
+=
line
err
+=
line
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment