Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ptp-dev] RemoteProcess and console output

Hi,

It looks like there is a race condition.  Whilst debugging I noticed that I received the console output but when I run with no breakpoints there is no console output.  So I put some tracing in to see what was happening and tracked the problem down to the fact that the streams for ProcessConsole are being close in the init function because the process has finished.  So when the following lines are executed

IRemoteProcess remoteProcess = pb.start();
RemoteProcessAdapter process = new RemoteProcessAdapter(remoteProcess);

the process has ran the remote Valgrind application and read the results (which I also have put System.out.prinlns to see).  Now when in runs

DebugPlugin.newProcess(launch, process, renderProcessLabel(localExePath.toOSString()));
this ends up creating a new ProcessConsole and in the init function the fProcess has terminated so it closes the streams but without reading the data from them:
    protected void init() {
        super.init();
        if (fProcess.isTerminated()) {
            closeStreams();
            resetName();
        } else {
            DebugPlugin.getDefault().addDebugEventListener(this);
        }
 
Anybody know what's the best solution to this?  Should RemoteProcess not start straight away and somehow start when DebugPlugin.newProcess has been called or should ProcessConsole read the streams when terminated?

Many Thanks,
Martin.


On Sat, Feb 13, 2016 at 7:24 PM, Martin Townsend <mtownsend1973@xxxxxxxxx> wrote:
Hi,

I'm updating the Remote profiling tools, starting with Valgrind over to org.eclipse.remote.   I have everything working except that I want to capture the output of the RemoteProcess in the console but for some reason it terminates before any output is captured.  Here's the code that I'm using:
        remoteConn.open(monitor.newChild(1));
        IRemoteProcessService ps = remoteConn.getService(IRemoteProcessService.class);
        IRemoteProcessBuilder pb = ps.getProcessBuilder();
        pb.command(valgrindCmdList);

        IRemoteProcess remoteProcess = pb.start();
        RemoteProcessAdapter process = new RemoteProcessAdapter(remoteProcess);
        DebugPlugin.newProcess(launch, process, renderProcessLabel(localExePath.toOSString()));

        while (!remoteProcess.isCompleted()) {
            remoteProcess.waitFor();
        }

I know everything is fine as I can grab the log files and parse them etc.  But I would like is to see the RemoteProcess stdout/stderr

The connection is an SSH connection to localhost (just for test purposes) in case this helps.

Any help appreciated,
Martin.




Back to the top