@@ -116,8 +116,6 @@ std::wstring process_windows_args(const std::vector<std::string> commandvec)
116
116
117
117
piped_processt::piped_processt (const std::vector<std::string> commandvec)
118
118
{
119
- // Default state
120
- process_state = statet::NOT_CREATED;
121
119
# ifdef _WIN32
122
120
// Security attributes for pipe creation
123
121
SECURITY_ATTRIBUTES sec_attr;
@@ -300,7 +298,7 @@ piped_processt::piped_processt(const std::vector<std::string> commandvec)
300
298
command_stream = fdopen (pipe_input[1 ], " w" );
301
299
}
302
300
# endif
303
- process_state = statet::CREATED ;
301
+ process_state = statet::RUNNING ;
304
302
}
305
303
306
304
piped_processt::~piped_processt ()
@@ -329,7 +327,7 @@ piped_processt::~piped_processt()
329
327
330
328
piped_processt::send_responset piped_processt::send (const std::string &message)
331
329
{
332
- if (process_state != statet::CREATED )
330
+ if (process_state != statet::RUNNING )
333
331
{
334
332
return send_responset::ERRORED;
335
333
}
@@ -355,7 +353,7 @@ piped_processt::send_responset piped_processt::send(const std::string &message)
355
353
std::string piped_processt::receive ()
356
354
{
357
355
INVARIANT (
358
- process_state == statet::CREATED ,
356
+ process_state == statet::RUNNING ,
359
357
" Can only receive() from a fully initialised process" );
360
358
std::string response = std::string (" " );
361
359
char buff[BUFSIZE];
@@ -374,7 +372,7 @@ std::string piped_processt::receive()
374
372
// Added the status back in here to keep parity with old implementation
375
373
// TODO: check which statuses are really used/needed.
376
374
if (nbytes == 0 ) // Update if the pipe is stopped
377
- process_state = statet::STOPPED ;
375
+ process_state = statet::ERRORED ;
378
376
success = nbytes > 0 ;
379
377
#endif
380
378
INVARIANT (
@@ -464,7 +462,7 @@ bool piped_processt::can_receive()
464
462
465
463
void piped_processt::wait_receivable (int wait_time)
466
464
{
467
- while (process_state == statet::CREATED && !can_receive (0 ))
465
+ while (process_state == statet::RUNNING && !can_receive (0 ))
468
466
{
469
467
#ifdef _WIN32
470
468
Sleep (wait_time);
0 commit comments