mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-21 12:00:18 +00:00
...
This commit is contained in:
parent
b282630b02
commit
89ec12cada
@ -4,6 +4,7 @@ namespace pkpy{
|
|||||||
|
|
||||||
VM::VM(bool enable_os) : heap(this), enable_os(enable_os) {
|
VM::VM(bool enable_os) : heap(this), enable_os(enable_os) {
|
||||||
this->vm = this;
|
this->vm = this;
|
||||||
|
this->_c.error = nullptr;
|
||||||
_stdout = [](VM* vm, const Str& s) {
|
_stdout = [](VM* vm, const Str& s) {
|
||||||
PK_UNUSED(vm);
|
PK_UNUSED(vm);
|
||||||
std::cout << s;
|
std::cout << s;
|
||||||
|
@ -103,6 +103,15 @@ int main(int argc, char** argv){
|
|||||||
std::filesystem::current_path(filepath.parent_path());
|
std::filesystem::current_path(filepath.parent_path());
|
||||||
|
|
||||||
bool ok = pkpy_exec_2(vm, src.c_str(), filepath.filename().string().c_str(), 0, NULL);
|
bool ok = pkpy_exec_2(vm, src.c_str(), filepath.filename().string().c_str(), 0, NULL);
|
||||||
|
if(!ok){
|
||||||
|
char* err;
|
||||||
|
if(pkpy_clear_error(vm, &err)){
|
||||||
|
std::cerr << err << std::endl;
|
||||||
|
pkpy_free(err);
|
||||||
|
}else{
|
||||||
|
std::cerr << "Unknown error" << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
pkpy_delete_vm(vm);
|
pkpy_delete_vm(vm);
|
||||||
return ok ? 0 : 1;
|
return ok ? 0 : 1;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user