X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=source%2Fcore%2Fprocess.cpp;h=43b7384a5a3d66d49fd708e45d7cd274795f04ac;hp=dfbea341310d19a039e4924ee122c1c0fd054f9d;hb=HEAD;hpb=ea60f3548d4769c356b796cb27cd690cdfe4b6d9 diff --git a/source/core/process.cpp b/source/core/process.cpp index dfbea34..4c5ed46 100644 --- a/source/core/process.cpp +++ b/source/core/process.cpp @@ -1,4 +1,5 @@ #include +#include "except.h" #include "process.h" #include "process_private.h" @@ -6,30 +7,15 @@ using namespace std; namespace Msp { -Process *Process::_self = 0; +Process *Process::_self = nullptr; Process::Process(const Private &p): priv(new Private(p)) -{ - init(); -} +{ } Process::Process(): priv(new Private) -{ - init(); -} - -void Process::init() -{ - redirect = false; - cin = 0; - cout = 0; - cerr = 0; - running = false; - finished = false; - exit_code = 0; -} +{ } Process &Process::self() { @@ -93,7 +79,7 @@ void Process::execute(const FS::Path &command, const Arguments &args) unsigned Process::get_exit_code() const { if(!finished) - throw logic_error("not finished"); + throw invalid_state("not finished"); return exit_code; }