Example #1
0
def popen(executable, arguments):
    global process  # XXX: keep it alive
    processStartInfo = ProcessStartInfo(executable, arguments)
    processStartInfo.UseShellExecute = False
    processStartInfo.CreateNoWindow = True
    processStartInfo.RedirectStandardOutput = True
    process = Process.Start(processStartInfo)
    return file(process.StandardOutput.BaseStream, "r")
Example #2
0
def popen(executable, arguments):
    global process # XXX: keep it alive
    processStartInfo = ProcessStartInfo(executable, arguments)
    processStartInfo.UseShellExecute = False
    processStartInfo.CreateNoWindow = True
    processStartInfo.RedirectStandardOutput = True
    process = Process.Start(processStartInfo)
    return file(process.StandardOutput.BaseStream, "r")
Example #3
0
def start_imaging(path):
    psInfo = ProcessStartInfo()
    psInfo.FileName = path + "Imaging.exe"
    psInfo.Arguments = "Rowthon 1"
    psInfo.CreateNoWindow = False
    psInfo.UseShellExecute = False
    psInfo.RedirectStandardOutput = True

    p = Process.Start(psInfo)
Example #4
0
def StartRevitProcess(revitVersion, initEnvironmentVariables):
    revitExecutableFilePath = RevitVersion.GetRevitExecutableFilePath(revitVersion)
    psi = ProcessStartInfo(revitExecutableFilePath)
    psi.UseShellExecute = False
    psi.RedirectStandardError = True
    psi.RedirectStandardOutput = True
    psi.WorkingDirectory = RevitVersion.GetRevitExecutableFolderPath(revitVersion)
    initEnvironmentVariables(psi.EnvironmentVariables)
    revitProcess = Process.Start(psi)
    return revitProcess
Example #5
0
def StartCmdProcess(commandLine):
    # NOTE: do not call Process.WaitForExit() until redirected streams have been entirely read from / closed.
    #       doing so can lead to a deadlock when the child process is waiting on being able to write to output / error
    #       stream and the parent process is waiting for the child to exit! See Microsoft's documentation for more info.
    # NOTE: if redirecting both output and error streams, one should be read asynchronously to avoid a deadlock where
    #       the child process is waiting to write to one of the streams and the parent is waiting for data from the other
    #       stream. See Microsoft's documentation for more info.
    psi = ProcessStartInfo('cmd.exe', '/U /S /C " ' + commandLine + ' "')
    psi.UseShellExecute = False
    psi.CreateNoWindow = True
    psi.RedirectStandardInput = False
    psi.RedirectStandardError = False  # See notes above if enabling this alongside redirect output stream.
    psi.RedirectStandardOutput = True
    psi.StandardOutputEncoding = Encoding.Unicode
    p = Process.Start(psi)
    return p