##// END OF EJS Templates
Summary of changes:...
Summary of changes: 1) IPython/core/compilerop.py: IronPython __future__ flags are non-standard, Solution try/except; comment added 2) IPython/core/completer.py: __main__ was undefined, due to local mistake in creating IronPython scope; removed this tweak 3) IPython/core/prompts.py: os.getuid() is not defined (IronPython bug; see: https://mail.python.org/pipermail/ironpython-users/2014-February/016812.html) 4) IPython/lib/inputhook.py: ctypes SystemError; comment added 5) IPython/utils/process.py and IPython/utils/_process_cli.py: adds a new _process_cli.py which would handle the processes under cli; fixed os.pathsep 6) IPython/utils/io.py: devnull opened in append mode; changed to "w" 7) New issue: IPython/external/decorator/_decorator.py: IronPython doesn't have _getframes, unless FullFrames is set to true; comment added

File last commit:

r15208:301956c6
r15208:301956c6
Show More
_process_cli.py
60 lines | 1.8 KiB | text/x-python | PythonLexer
"""
cli-specific implementation of process utilities.
cli - Common Language Infrastructure for IronPython. Code
can run on any operating system. Check os.name for os-
specific settings.
This file is only meant to be imported by process.py, not by end-users.
"""
# Import cli libraries:
import clr
import System
# Import Python libraries:
import os
# Import IPython libraries:
from IPython.utils import py3compat
from ._process_common import arg_split
def _find_cmd(cmd):
"""Find the full path to a command using which."""
paths = System.Environment.GetEnvironmentVariable("PATH").Split(os.pathsep)
for path in paths:
filename = os.path.join(path, cmd)
if System.IO.File.Exists(filename):
return py3compat.bytes_to_str(filename)
raise OSError("command %r not found" % cmd)
def system(cmd):
"""
system(cmd) should work in a cli environment on Mac OSX, Linux,
and Windows
"""
psi = System.Diagnostics.ProcessStartInfo(cmd)
psi.RedirectStandardOutput = True
psi.RedirectStandardError = True
psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal
psi.UseShellExecute = False
# Start up process:
reg = System.Diagnostics.Process.Start(psi)
def getoutput(cmd):
"""
getoutput(cmd) should work in a cli environment on Mac OSX, Linux,
and Windows
"""
psi = System.Diagnostics.ProcessStartInfo(cmd)
psi.RedirectStandardOutput = True
psi.RedirectStandardError = True
psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal
psi.UseShellExecute = False
# Start up process:
reg = System.Diagnostics.Process.Start(psi)
myOutput = reg.StandardOutput
output = myOutput.ReadToEnd()
myError = reg.StandardError
error = myError.ReadToEnd()
return output