[Ironpython-users] IronPython, Daily Digest 12/27/2012

no_reply at codeplex.com no_reply at codeplex.com
Fri Dec 28 09:44:30 CET 2012


Hi ironpython,

Here's your Daily Digest of new issues for project "IronPython".

In today's digest:ISSUES

1. [New comment] Iron Python drops core when trying to execute a Iron Python script.

----------------------------------------------

ISSUES

1. [New comment] Iron Python drops core when trying to execute a Iron Python script.
http://ironpython.codeplex.com/workitem/33390
User Subramanya_M_S has commented on the issue:

"I am using .Net 4.5 with Visual Studio 2010, on Windows Server 2008 R2.

This is part of the script that caused the core.


def runShellCommandAction(_session, _env, run_shell_command, with_arguments="", without_waiting=False, timeout_after=0.0):
    shellCommandName = run_shell_command

    argSpec = with_arguments
    #displayName = _env["display_name"]
    displayName = shellCommandName
    def tail_minus_f(fileName, maxLinesReturned=0):
        oldSize=0
        while True:
            currentSize = os.path.getsize(fileName)
            if currentSize<=oldSize:
                yield []
                continue

            file = open(fileName, 'rb')
            file.seek(oldSize)
            lines=[]
            for line in file:
                line = line.strip()
                if (line):
                    lines.append(line)
                    if maxLinesReturned and len(lines)>=maxLinesReturned:
                        break

            oldSize = file.tell()
            file.close()
            yield lines

    if shellCommandName != os.path.basename(shellCommandName):
        raise ValueError("shell command name incorrect. %s" % shellCommandName)
    
    ext = os.path.splitext(shellCommandName)
    print "Extention = " + str(ext)
    
    shellCommand = ""
    newargs = ""
    if ext[1] == ".ps1":
    	shellCommand = "powershell.exe"
        newargs = "-ExecutionPolicy Unrestricted -File "
    elif ext[1] == ".sh":
    	shellCommand = "posix.exe"
        newargs = "/u /c /usr/local/bin/bash "
    elif ext[1] == ".bash":
    	shellCommand = "posix.exe"
        newargs = "/u /c /usr/local/bin/bash "
    elif ext[1] == ".csh":
    	shellCommand = "posix.exe"
        newargs = "/u /c /bin/csh "
    elif ext[1] == ".ksh":
    	shellCommand = "posix.exe"
        newargs = "/u /c /bin/ksh "
    elif ext[1] == ".pl":
    	shellCommand = "perl.exe "
    elif ext[1] == ".py":
    	shellCommand = "ipy64.exe "
    elif shellCommandName == "sleep":
        shellCommand = "powershell.exe"
        newargs = "-ExecutionPolicy Unrestricted -Command "
    else :
        shellCommand = shellCommandName;
    	
    print "ShellCommand = " + str(shellCommand)
    shellCommandsFolder = ""
    sharedLoc = os.environ["LMSRVSHARED"].strip('\\')
    if shellCommand == "posix.exe":
    	shellCommandsFolder = "/dev/fs/" + sharedLoc.replace(":","") + "/tenant%s/scripts/ContactStrategy" % str(_session.tenant.id)
    	shellCommandsFolder = shellCommandsFolder.replace("\\","/")
    else:
    	shellCommandsFolder = os.environ["LMSRVSHARED"] + "\\tenant%s\\scripts\\ContactStrategy" % str(_session.tenant.id)
    	
    if shellCommandName == "sleep":
        absoluteCommandPath = "sleep"
    elif shellCommand != shellCommandName:
    	if shellCommand == "posix.exe":
    		absoluteCommandPath = '"' + shellCommandsFolder + "/" + shellCommandName + '"'
    	else:
        	absoluteCommandPath = '"' + os.path.join(shellCommandsFolder, shellCommandName) + '"'
    else:
        absoluteCommandPath = ""
        
    args = argSpec.split()
    commandLine = '%s' % ' '.join([absoluteCommandPath]+args)
    
    if shellCommand != shellCommandName:
        commandLine = newargs + commandLine
    
    print "Execute Line: %s" % shellCommand+" "+commandLine
    args = [shellCommand,commandLine]
    child = subprocess.Popen(args,env,shell=True,stdout=PIPE,stderr=PIPE)

    outFileIter = child.stdout
    errFileIter = child.stderr

    def insertFileLinesToMessages(fileIter, msgType):
        for line in fileIter:
            print "message", line, msgType
            _session.messages.insert(msgType, "CS_MSG", [ "%s - %s" % (displayName, line)])

    def isSubprocessComplete():
        if child.poll() is None:
            return retry()

        print 'Return Code: ' + str(child.returncode)
        if child.returncode==127:
            return finished(ERROR, "FT_FILE_NOENT(%s)" % absoluteCommandPath)
        if child.returncode==126:
            return finished(ERROR, "%s - Permission denied" % absoluteCommandPath)
        if child.returncode>0:
            return finished(ERROR, "%s returned %s" % (shellCommandName,child.returncode))
        if child.returncode<0:
            return finished(ERROR, " %s was iterrupted by signal %s" % (shellCommandName, -child.returncode))"
----------------------------------------------



----------------------------------------------
You are receiving this email because you subscribed to notifications on CodePlex.

To report a bug, request a feature, or add a comment, visit IronPython Issue Tracker. You can unsubscribe or change your issue notification settings on CodePlex.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20121228/114e6cea/attachment.html>


More information about the Ironpython-users mailing list