Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] 2 questions re: launch

I am not sure I understand what you are trying to do. But you can use IProcess to get the exit code and access to streams proxy. See ILaunch.getProcesses.

----- Original Message ----- From: "Derek Morris" <dmsubs@xxxxxxxxxxxxx>
To: <cdt-dev@xxxxxxxxxxx>
Sent: Tuesday, May 30, 2006 1:12 PM
Subject: [cdt-dev] 2 questions re: launch



DerekHi,

I'm launching an external application that does some processing and
either a) creates a file with its results or b) outputs its results to
stdout.

Q1: How do I detect the program has exited, and get its exit code?
Q2: How do I capture its output (preferably in an InputStream)?

My launch code looks like this: (Note for debug purposes, I am using a
console for the external program output)

public ILaunch launch(IProgressMonitor monitor) throws CoreException
{
    ILaunchManager launchManager = DebugPlugin.getDefault()
                .getLaunchManager();
    ILaunchConfigurationType type = launchManager
        .getLaunchConfigurationType(LAUNCH_CONFIG_TYPE);

    String name = launchManager
        .generateUniqueLaunchConfigurationNameFrom(
        launchFile.getName());
    ILaunchConfigurationWorkingCopy workingCopy =
        type.newInstance(null, name);

    workingCopy.setAttribute(ATTR_LOCATION,
        launchFile.getAbsolutePath());
    workingCopy.setAttribute(ATTR_WORKING_DIRECTORY, workingDir
                .getAbsolutePath());
    workingCopy.setAttribute(ATTR_TOOL_ARGUMENTS,
        toolArguments);

    workingCopy.setAttribute(IDebugUIConstants.ATTR_PRIVATE,
        true);

    return workingCopy.launch("run", monitor);
}

Thanks,
_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev



Back to the top