Skip to content

Commit 899e9b9

Browse files
bdangitarun11299
authored andcommitted
Replace throw with noexcept for C17 compatibility (#17)
C++11 started to deprecate the use of throw function identifiers. In C++17, this header no longer compiles due to the deprecation. Signed-off-by: Ben Dang <me@bdang.it>
1 parent a90174c commit 899e9b9

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

subprocess.hpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ namespace util
217217
* Second element is the write descriptor of pipe.
218218
*/
219219
static inline
220-
std::pair<int, int> pipe_cloexec() throw (OSError)
220+
std::pair<int, int> pipe_cloexec() noexcept(false)
221221
{
222222
int pipe_fds[2];
223223
int res = pipe(pipe_fds);
@@ -965,15 +965,15 @@ class Popen
965965
if (!defer_process_start_) execute_process();
966966
}
967967

968-
void start_process() throw (CalledProcessError, OSError);
968+
void start_process() noexcept(false);
969969

970970
int pid() const noexcept { return child_pid_; }
971971

972972
int retcode() const noexcept { return retcode_; }
973973

974-
int wait() throw(OSError);
974+
int wait() noexcept(false);
975975

976-
int poll() throw(OSError);
976+
int poll() noexcept(false);
977977

978978
// Does not fail, Caller is expected to recheck the
979979
// status with a call to poll()
@@ -1017,7 +1017,7 @@ class Popen
10171017
void init_args(F&& farg, Args&&... args);
10181018
void init_args();
10191019
void populate_c_argv();
1020-
void execute_process() throw (CalledProcessError, OSError);
1020+
void execute_process() noexcept(false);
10211021

10221022
private:
10231023
detail::Streams stream_;
@@ -1066,7 +1066,7 @@ inline void Popen::populate_c_argv()
10661066
cargv_.push_back(nullptr);
10671067
}
10681068

1069-
inline void Popen::start_process() throw (CalledProcessError, OSError)
1069+
inline void Popen::start_process() noexcept(false)
10701070
{
10711071
// The process was started/tried to be started
10721072
// in the constructor itself.
@@ -1080,7 +1080,7 @@ inline void Popen::start_process() throw (CalledProcessError, OSError)
10801080
execute_process();
10811081
}
10821082

1083-
inline int Popen::wait() throw (OSError)
1083+
inline int Popen::wait() noexcept(false)
10841084
{
10851085
int ret, status;
10861086
std::tie(ret, status) = util::wait_for_child_exit(pid());
@@ -1095,7 +1095,7 @@ inline int Popen::wait() throw (OSError)
10951095
return 0;
10961096
}
10971097

1098-
inline int Popen::poll() throw (OSError)
1098+
inline int Popen::poll() noexcept(false)
10991099
{
11001100
int status;
11011101
if (!child_created_) return -1; // TODO: ??
@@ -1137,7 +1137,7 @@ inline void Popen::kill(int sig_num)
11371137
}
11381138

11391139

1140-
inline void Popen::execute_process() throw (CalledProcessError, OSError)
1140+
inline void Popen::execute_process() noexcept(false)
11411141
{
11421142
int err_rd_pipe, err_wr_pipe;
11431143
std::tie(err_rd_pipe, err_wr_pipe) = util::pipe_cloexec();

0 commit comments

Comments
 (0)