Return no status from successful variable assignments

This commit is contained in:
Soumya
2020-08-02 13:31:00 -07:00
committed by ridiculousfish
parent 8dd2d4f15d
commit 539e6fe8b1
5 changed files with 61 additions and 3 deletions

View File

@@ -293,6 +293,13 @@ static void run_internal_process_or_short_circuit(parser_t &parser, const std::s
if (statuses) {
parser.set_last_statuses(statuses.value());
parser.libdata().status_count++;
} else if (j->flags().negate) {
// Special handling for `not set var (substitution)`.
// If there is no status, but negation was requested,
// take the last status and negate it.
auto last_statuses = parser.get_last_statuses();
last_statuses.status = !last_statuses.status;
parser.set_last_statuses(last_statuses);
}
}
} else {