Skip to content
This repository was archived by the owner on Jun 25, 2020. It is now read-only.

Commit ed9c394

Browse files
committed
feature: add processes from terminal to api
@eidheim are there any chances for a tty in the future?
1 parent 3bfdf43 commit ed9c394

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/python_interpreter.cc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include <pygobject.h>
66
#include "menu.h"
77
#include "directories.h"
8+
#include <pybind11/functional.h>
89

910
static wchar_t* DecodeLocale(const char* arg, size_t *size)
1011
{
@@ -68,7 +69,13 @@ Python::Interpreter::Interpreter(){
6869
.def("get_gtk_notebook",[](){return pyobject_from_gobj(Notebook::get().gobj());})
6970
.def_submodule("terminal")
7071
.def("get_gtk_text_view",[](){return pyobject_from_gobj(Terminal::get().gobj());})
71-
.def("println", [](const std::string &message){ Terminal::get().print(message +"\n"); });
72+
.def("println", [](const std::string &message){ Terminal::get().print(message +"\n"); })
73+
.def("process",[](std::string command, std::string path, bool use_pipes){
74+
return Terminal::get().process(command, path, use_pipes);
75+
})
76+
.def("process_async",[](std::string command, std::string path, std::function<void(int exit_status)>callback){
77+
return Terminal::get().async_process(command,path,callback);
78+
});
7279
api.def_submodule("directories")
7380
.def("get_gtk_treeview",[](){return pyobject_from_gobj(Directories::get().gobj());})
7481
.def("open",[](const std::string &directory){Directories::get().open(directory);})

0 commit comments

Comments
 (0)