mirror of
https://github.com/ksherlock/mpw-shell.git
synced 2024-09-27 03:54:51 +00:00
fix if evaluation.
This commit is contained in:
parent
44b42e4fe4
commit
54e1491e6f
11
command.cpp
11
command.cpp
@ -292,6 +292,12 @@ int begin_command::execute(Environment &env, const fdmask &fds, bool throwup) {
|
|||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* returns:
|
||||||
|
* <0 -> error
|
||||||
|
* 0 -> false
|
||||||
|
* >0 -> true
|
||||||
|
*/
|
||||||
|
|
||||||
int evaluate(int type, const std::string &s, Environment &env) {
|
int evaluate(int type, const std::string &s, Environment &env) {
|
||||||
|
|
||||||
@ -360,8 +366,9 @@ int if_command::execute(Environment &env, const fdmask &fds, bool throwup) {
|
|||||||
{
|
{
|
||||||
indent_helper indent(env);
|
indent_helper indent(env);
|
||||||
int tmp = evaluate(c->type, s, env);
|
int tmp = evaluate(c->type, s, env);
|
||||||
if (tmp < 0) { ok = true; rv = tmp; }
|
if (tmp < 0) { ok = true; rv = tmp; continue; }
|
||||||
else rv = c->execute(env, newfds);
|
if (tmp == 0) continue;
|
||||||
|
rv = c->execute(env, newfds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user