Z
zeezlo
Hi everyone
I would like to get the output of a shell process on Linux (eg, "ls
--color=auto") run via os.popen(), filter it and then output parts of
it while preserving any original coloring added by that process.
Doing
child = os.popen("ls --color=auto")
output = child.read()
results in an output string which is free of the escape sequences
generated by ls.
Is there a way to preserve them when I capture whatever the processes
writes to stdout? I could add them manually (or use curses), but then I
would just be duplicating the work done by ls.
Thanks in advance
Juergen
I would like to get the output of a shell process on Linux (eg, "ls
--color=auto") run via os.popen(), filter it and then output parts of
it while preserving any original coloring added by that process.
Doing
child = os.popen("ls --color=auto")
output = child.read()
results in an output string which is free of the escape sequences
generated by ls.
Is there a way to preserve them when I capture whatever the processes
writes to stdout? I could add them manually (or use curses), but then I
would just be duplicating the work done by ls.
Thanks in advance
Juergen