slightly nicer code
This commit is contained in:
parent
a2a01dd676
commit
78f870c17d
7
ml.cpp
7
ml.cpp
|
|
@ -1142,11 +1142,8 @@ namespace builtin {
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<long, std::string> result = client.doGetRequest(args[0].as_string(), headers);
|
std::pair<long, std::string> result = client.doGetRequest(args[0].as_string(), headers);
|
||||||
// TODO add helper function for this
|
|
||||||
std::vector<MlValue> lst;
|
return std::vector<MlValue> { MlValue(result.first), MlValue::string(result.second) };
|
||||||
lst.push_back(MlValue(result.first));
|
|
||||||
lst.push_back(MlValue::string(result.second));
|
|
||||||
return lst;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parse JSON string
|
// Parse JSON string
|
||||||
|
|
|
||||||
|
|
@ -91,9 +91,5 @@ MlValue exec_system_cmd(const std::string &cmd) {
|
||||||
stat = pclose(pipe);
|
stat = pclose(pipe);
|
||||||
int cmd_retval = WEXITSTATUS(stat);
|
int cmd_retval = WEXITSTATUS(stat);
|
||||||
|
|
||||||
// TODO add helper function for this
|
return std::vector<MlValue> { MlValue((long)cmd_retval), MlValue::string(cmd_output) };
|
||||||
std::vector<MlValue> lst;
|
|
||||||
lst.push_back(MlValue((long)cmd_retval));
|
|
||||||
lst.push_back(MlValue::string(cmd_output));
|
|
||||||
return lst;
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue