Lines Matching +full:stdout +full:- +full:path
54 #include "utils/fs/path.hpp"
95 /// Basename of the file containing the stdout of the subprocess.
96 const char* utils::process::executor::detail::stdout_name = "stdout.txt";
111 /// Prepares a subprocess to run a user-provided hook in a controlled manner.
114 /// \param control_directory Path to the subprocess-specific control directory.
115 /// \param work_directory Path to the subprocess-specific work directory.
119 const fs::path& control_directory,
120 const fs::path& work_directory)
133 /// Path to the subprocess-specific work directory.
134 fs::path control_directory;
136 /// Path to the subprocess's stdout file.
137 const fs::path stdout_file;
139 /// Path to the subprocess's stderr file.
140 const fs::path stderr_file;
151 /// Number of owners of the on-disk state.
157 /// \param control_directory_ Path to the subprocess-specific work
159 /// \param stdout_file_ Path to the subprocess's stdout file.
160 /// \param stderr_file_ Path to the subprocess's stderr file.
165 /// \param [in,out] state_owners_ Number of owners of the on-disk state.
166 /// For first-time processes, this should be a new counter set to 0;
170 const fs::path& control_directory_,
171 const fs::path& stdout_file_,
172 const fs::path& stderr_file_,
213 return _pimpl->pid;
217 /// Returns the path to the subprocess-specific control directory.
221 /// \return The path to a directory that exists until cleanup() is called.
222 fs::path
225 return _pimpl->control_directory;
229 /// Returns the path to the subprocess-specific work directory.
233 /// \return The path to a directory that exists until cleanup() is called.
234 fs::path
237 return _pimpl->control_directory / detail::work_subdir;
241 /// Returns the path to the subprocess's stdout file.
243 /// \return The path to a file that exists until cleanup() is called.
244 const fs::path&
247 return _pimpl->stdout_file;
251 /// Returns the path to the subprocess's stderr file.
253 /// \return The path to a file that exists until cleanup() is called.
254 const fs::path&
257 return _pimpl->stderr_file;
281 /// Path to the subprocess-specific work directory.
282 const fs::path control_directory;
284 /// Path to the subprocess's stdout file.
285 const fs::path stdout_file;
287 /// Path to the subprocess's stderr file.
288 const fs::path stderr_file;
290 /// Number of owners of the on-disk state.
292 /// This will be 1 if this exit_handle is the last holder of the on-disk
319 /// \param control_directory_ Path to the subprocess-specific work
321 /// \param stdout_file_ Path to the subprocess's stdout file.
322 /// \param stderr_file_ Path to the subprocess's stderr file.
323 /// \param [in,out] state_owners_ Number of owners of the on-disk state.
332 const fs::path& control_directory_,
333 const fs::path& stdout_file_,
334 const fs::path& stderr_file_,
361 /// Cleans up the subprocess on-disk state.
374 "%s owners left") % original_pid % (*state_owners - 1));
381 (*state_owners)--;
418 PRE(!_pimpl->cleaned);
419 _pimpl->cleanup();
420 POST(_pimpl->cleaned);
424 /// Gets the current number of owners of the on-disk data.
433 return _pimpl->state_owners;
443 return _pimpl->original_pid;
453 return _pimpl->status;
464 return _pimpl->unprivileged_user;
474 return _pimpl->start_time;
484 return _pimpl->end_time;
488 /// Returns the path to the subprocess-specific control directory.
492 /// \return The path to a directory that exists until cleanup() is called.
493 fs::path
496 return _pimpl->control_directory;
500 /// Returns the path to the subprocess-specific work directory.
504 /// \return The path to a directory that exists until cleanup() is called.
505 fs::path
508 return _pimpl->control_directory / detail::work_subdir;
512 /// Returns the path to the subprocess's stdout file.
514 /// \return The path to a file that exists until cleanup() is called.
515 const fs::path&
518 return _pimpl->stdout_file;
522 /// Returns the path to the subprocess's stderr file.
524 /// \return The path to a file that exists until cleanup() is called.
525 const fs::path&
528 return _pimpl->stderr_file;
599 if (::waitpid(pid, &status, 0) == -1) {
628 // individually wiped the subdirectories of any still-unclean
630 root_work_directory->cleanup();
634 root_work_directory->directory() % e.what());
638 interrupts_handler->unprogram();
647 /// \return A pointer to an object describing the waited-for subprocess.
659 data._pimpl->timer.unprogram();
663 // always the case though: for short-lived processes and with very short
682 data._pimpl->timer.fired() ?
684 data._pimpl->unprivileged_user,
685 data._pimpl->start_time, datetime::timestamp::now(),
689 data._pimpl->state_owners,
699 data._pimpl->timer.unprogram();
712 data._pimpl->unprivileged_user,
713 data._pimpl->start_time, datetime::timestamp::now(),
717 data._pimpl->state_owners,
735 /// Queries the path to the root of the work directory for all subprocesses.
737 /// \return A path.
738 const fs::path&
741 return _pimpl->root_work_directory->directory();
755 PRE(!_pimpl->cleaned);
756 _pimpl->cleanup();
757 _pimpl->cleaned = true;
774 /// Pre-helper for the spawn() method.
777 fs::path
782 ++_pimpl->last_subprocess;
784 const fs::path control_directory =
785 _pimpl->root_work_directory->directory() /
786 (F("%s") % _pimpl->last_subprocess);
793 /// Post-helper for the spawn() method.
796 /// \param stdout_file Path to the subprocess' stdout.
797 /// \param stderr_file Path to the subprocess' stderr.
805 const fs::path& control_directory,
806 const fs::path& stdout_file,
807 const fs::path& stderr_file,
814 child->pid(),
823 auto insert_pair = _pimpl->all_exec_handles.insert(value);
826 _pimpl->stale_exec_handles.push_front(insert_pair.first->second);
827 _pimpl->all_exec_handles.erase(insert_pair.first);
828 insert_pair = _pimpl->all_exec_handles.insert(value);
837 /// Pre-helper for the spawn_followup() method.
845 /// Post-helper for the spawn_followup() method.
861 child->pid(),
870 auto insert_pair = _pimpl->all_exec_handles.insert(value);
873 _pimpl->stale_exec_handles.push_front(insert_pair.first->second);
874 _pimpl->all_exec_handles.erase(insert_pair.first);
875 insert_pair = _pimpl->all_exec_handles.insert(value);
888 /// \return A pointer to an object describing the waited-for subprocess.
894 return _pimpl->post_wait(exec_handle.pid(), status);
900 /// \return A pointer to an object describing the waited-for subprocess.
906 return _pimpl->post_wait(status.dead_pid(), status);
920 return _pimpl->reap(pid);