Skip to content

Commit

Permalink
Throw error when task config write is unsuccessfully (#3620)
Browse files Browse the repository at this point in the history
  • Loading branch information
gagankonana authored Sep 11, 2024
1 parent 6a24510 commit c00c0e9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/commands/CmdConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ bool CmdConfig::setConfigVariable(const std::string& name, const std::string& va
change = true;
}

if (change) File::write(Context::getContext().config.file(), contents);
if (change)
if (!File::write(Context::getContext().config.file(), contents))
throw format("Could not write to '{1}'.", Context::getContext().config.file());

return change;
}
Expand Down Expand Up @@ -133,7 +135,9 @@ int CmdConfig::unsetConfigVariable(const std::string& name, bool confirmation /*
if (!lineDeleted) line++;
}

if (change) File::write(Context::getContext().config.file(), contents);
if (change)
if (!File::write(Context::getContext().config.file(), contents))
throw format("Could not write to '{1}'.", Context::getContext().config.file());

if (change && found)
return 0;
Expand Down

0 comments on commit c00c0e9

Please sign in to comment.