Minor cleanup of how jobs store their command string

This commit is contained in:
ridiculousfish 2019-09-09 09:07:25 -07:00
parent 535a448d0e
commit 56d2942f59
2 changed files with 2 additions and 5 deletions

View file

@ -145,7 +145,7 @@ static bool find_job_by_name(const wchar_t *proc, std::vector<job_id_t> &ids,
bool found = false;
for (const auto &j : parser.jobs()) {
if (j->command_is_empty()) continue;
if (j->command().empty()) continue;
if (match_pid(j->command(), proc)) {
if (!contains(ids, j->job_id)) {

View file

@ -322,9 +322,6 @@ class job_t {
std::shared_ptr<job_t> parent);
~job_t();
/// Returns whether the command is empty.
bool command_is_empty() const { return command_str.empty(); }
/// Returns the command as a wchar_t *. */
const wchar_t *command_wcstr() const { return command_str.c_str(); }
@ -332,7 +329,7 @@ class job_t {
const wcstring &command() const { return command_str; }
/// Sets the command.
void set_command(const wcstring &cmd) { command_str = cmd; }
void set_command(wcstring cmd) { command_str = std::move(cmd); }
/// \return whether it is OK to reap a given process. Sometimes we want to defer reaping a
/// process if it is the group leader and the job is not yet constructed, because then we might