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've got it working (but it was a bit more complex than I was hoping...)

Thanks for you help.
--
Derek

Mikhail Khodjaiants wrote:
1. This is probably a dumb question, but how do I turn a StreamsProxy into a Stream?
IStreamsProxy provides access to the stream monitors. You can add a listener to IStreamMonitor.

2. How do I wait for the Process to finish?
Register a listener to debug events (DebugPlugin.getDefault().addDebugEventListener) and wait for the terminate event.

----- Original Message ----- From: "Derek Morris" <dmsubs@xxxxxxxxxxxxx>
To: "CDT General developers list." <cdt-dev@xxxxxxxxxxx>
Sent: Tuesday, May 30, 2006 4:22 PM
Subject: Re: [cdt-dev] 2 questions re: launch


Thanks for the info, but:

1. This is probably a dumb question, but how do I turn a StreamsProxy into a Stream?
2. How do I wait for the Process to finish?

Thanks

--
Derek

Mikhail Khodjaiants wrote:
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

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

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

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



Back to the top