Overview
Features
Download
Documentation
Community
Add-Ons & Services

PocoProcessHandle SegmentFault problem

Please post support and help requests here.

PocoProcessHandle SegmentFault problem

Postby aliva » 25 Apr 2012, 17:19

I have created a class to handle subprocess in my program

Code: Select all
#include <Poco/Process.h>

class SubProcess{
public:
    SubProcess(){
        *handle = process.launch("ls", args);
    }
    ~SubProcess(){
        handle->wait();
    }
private:
    Poco::Process::Args args;
    Poco::Process process;
    Poco::ProcessHandle *handle;
};


Code: Select all
#include "subprocess.hpp"

int main(int argc, char* argv[]){
    SubProcess sub;
}


the problem is when program reaches the *handle= it show a SegmentFault message.
when I remove handle object from my code my class works good but I want to use handle in other methods in class.

what should I do for the handle?
aliva
 
Posts: 1
Joined: 25 Apr 2012, 17:07

Re: PocoProcessHandle SegmentFault problem

Postby Tavi » 25 Apr 2012, 21:55

you are defining 'handle' as a pointer and you are not initializing it. Use ProcessHandle as is, without pointer.
Tavi
 
Posts: 7
Joined: 28 Nov 2011, 12:50


Return to Support

Who is online

Users browsing this forum: bgolenko and 4 guests