Skip to content

Commit c5f6392

Browse files
committed
fix: fix return value of runcmdEx #54
1 parent 74284d7 commit c5f6392

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/legacy/api/CommandAPI.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ Local<Value> McClass::runcmdEx(const Arguments& args) {
190190
);
191191
CommandOutput output(CommandOutputType::AllOutput);
192192
std::string outputStr;
193+
Local<Object> resObj = Object::newObject();
193194
try {
194195
if (command) {
195196
command->run(origin, output);
@@ -199,12 +200,12 @@ Local<Value> McClass::runcmdEx(const Arguments& args) {
199200
if (output.getMessages().size()) {
200201
outputStr.pop_back();
201202
}
202-
Local<Object> resObj = Object::newObject();
203203
resObj.set("success", output.getSuccessCount() ? true : false);
204204
resObj.set("output", outputStr);
205205
return resObj;
206206
}
207-
return {};
207+
resObj.set("success", false);
208+
return resObj;
208209
}
209210
CATCH("Fail in RunCmdEx!")
210211
}

0 commit comments

Comments
 (0)