mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
CmdEdit: Properly captures an unmodified errno
This commit is contained in:
parent
5716508694
commit
0bfac78f1e
1 changed files with 2 additions and 1 deletions
|
@ -770,13 +770,14 @@ ARE_THESE_REALLY_HARMFUL:
|
||||||
// Launch the editor.
|
// Launch the editor.
|
||||||
std::cout << format (STRING_EDIT_LAUNCHING, editor) << '\n';
|
std::cout << format (STRING_EDIT_LAUNCHING, editor) << '\n';
|
||||||
int exitcode = system (editor.c_str ());
|
int exitcode = system (editor.c_str ());
|
||||||
|
auto captured_errno = errno;
|
||||||
if (0 == exitcode)
|
if (0 == exitcode)
|
||||||
std::cout << STRING_EDIT_COMPLETE << '\n';
|
std::cout << STRING_EDIT_COMPLETE << '\n';
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::cout << format (STRING_EDIT_FAILED, exitcode) << '\n';
|
std::cout << format (STRING_EDIT_FAILED, exitcode) << '\n';
|
||||||
if (-1 == exitcode)
|
if (-1 == exitcode)
|
||||||
std::cout << std::strerror (errno) << '\n';
|
std::cout << std::strerror (captured_errno) << '\n';
|
||||||
return CmdEdit::editResult::error;
|
return CmdEdit::editResult::error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue