]> git.tdb.fi Git - libs/core.git/blobdiff - source/core/unix/process.cpp
Add new exception classes for some common errors
[libs/core.git] / source / core / unix / process.cpp
index 99be2e1d75a592a87a07e926439add7a4a5bec17..975fa223520486fd59122ae90e17e322fd4e755a 100644 (file)
@@ -4,6 +4,7 @@
 #include <msp/core/systemerror.h>
 #include <msp/fs/dir.h>
 #include <msp/io/console.h>
+#include "except.h"
 #include "process.h"
 #include "process_private.h"
 
@@ -35,7 +36,7 @@ void Process::execute(const string &command, bool path_search, const Arguments &
                        argv[0] = command.c_str();
                        for(unsigned i=0; i<args.size(); ++i)
                                argv[i+1] = args[i].c_str();
-                       argv[args.size()+1] = 0;
+                       argv[args.size()+1] = nullptr;
 
                        if(redirect)
                        {
@@ -70,7 +71,7 @@ void Process::execute(const string &command, bool path_search, const Arguments &
 bool Process::wait(bool block)
 {
        if(!running)
-               throw logic_error("not running");
+               throw invalid_state("not running");
 
        int status;
        int pid = waitpid(priv->info.pid, &status, (block ? 0 : WNOHANG));