mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-26 06:37:20 +02:00
Hooks
- Fixed the ::execute function used by Hooks and CmdCalendar to run commands, by following the convention: "The first argument, by convention, should point to the file name associated with the file being executed." (man execvp)
This commit is contained in:
parent
876820ee1a
commit
528e72062b
2 changed files with 4 additions and 4 deletions
|
@ -343,7 +343,6 @@ int CmdCalendar::execute (std::string& output)
|
||||||
executable = executable.substr (0, cal) + PACKAGE;
|
executable = executable.substr (0, cal) + PACKAGE;
|
||||||
|
|
||||||
std::vector <std::string> args;
|
std::vector <std::string> args;
|
||||||
args.push_back (executable);
|
|
||||||
args.push_back ("rc:" + context.rc_file._data);
|
args.push_back ("rc:" + context.rc_file._data);
|
||||||
args.push_back ("rc.due:0");
|
args.push_back ("rc.due:0");
|
||||||
args.push_back ("rc.verbose:label,affected,blank");
|
args.push_back ("rc.verbose:label,affected,blank");
|
||||||
|
|
|
@ -303,11 +303,12 @@ int execute (
|
||||||
if (dup2 (pout[1], STDOUT_FILENO) == -1)
|
if (dup2 (pout[1], STDOUT_FILENO) == -1)
|
||||||
throw std::string (std::strerror (errno));
|
throw std::string (std::strerror (errno));
|
||||||
|
|
||||||
char** argv = new char* [args.size () + 1];
|
char** argv = new char* [args.size () + 2];
|
||||||
|
argv[0] = (char*) executable.c_str ();
|
||||||
for (unsigned int i = 0; i < args.size (); ++i)
|
for (unsigned int i = 0; i < args.size (); ++i)
|
||||||
argv[i] = (char*) args[i].c_str ();
|
argv[i+1] = (char*) args[i].c_str ();
|
||||||
|
|
||||||
argv[args.size ()] = NULL;
|
argv[args.size () + 1] = NULL;
|
||||||
_exit (execvp (executable.c_str (), argv));
|
_exit (execvp (executable.c_str (), argv));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue