hoh# On branch master

This commit is contained in:
Juan Linietsky 2014-06-29 23:24:05 -03:00
parent 01632a824e
commit 7bb5693094
2 changed files with 6 additions and 3 deletions

View file

@ -235,7 +235,7 @@ Error _OS::shell_open(String p_uri) {
}; };
int _OS::execute(const String& p_path, const Vector<String> & p_arguments,bool p_blocking) { int _OS::execute(const String& p_path, const Vector<String> & p_arguments, bool p_blocking, Array p_output) {
OS::ProcessID pid; OS::ProcessID pid;
List<String> args; List<String> args;
@ -243,6 +243,8 @@ int _OS::execute(const String& p_path, const Vector<String> & p_arguments,bool p
args.push_back(p_arguments[i]); args.push_back(p_arguments[i]);
String pipe; String pipe;
Error err = OS::get_singleton()->execute(p_path,args,p_blocking,&pid, &pipe); Error err = OS::get_singleton()->execute(p_path,args,p_blocking,&pid, &pipe);
p_output.clear();
p_output.push_back(pipe);
if (err != OK) if (err != OK)
return -1; return -1;
else else
@ -616,7 +618,7 @@ void _OS::_bind_methods() {
ObjectTypeDB::bind_method(_MD("get_processor_count"),&_OS::get_processor_count); ObjectTypeDB::bind_method(_MD("get_processor_count"),&_OS::get_processor_count);
ObjectTypeDB::bind_method(_MD("get_executable_path"),&_OS::get_executable_path); ObjectTypeDB::bind_method(_MD("get_executable_path"),&_OS::get_executable_path);
ObjectTypeDB::bind_method(_MD("execute","path","arguments","blocking"),&_OS::execute); ObjectTypeDB::bind_method(_MD("execute","path","arguments","blocking","output"),&_OS::execute,DEFVAL(Array()));
ObjectTypeDB::bind_method(_MD("kill","pid"),&_OS::kill); ObjectTypeDB::bind_method(_MD("kill","pid"),&_OS::kill);
ObjectTypeDB::bind_method(_MD("shell_open","uri"),&_OS::shell_open); ObjectTypeDB::bind_method(_MD("shell_open","uri"),&_OS::shell_open);
ObjectTypeDB::bind_method(_MD("get_process_ID"),&_OS::get_process_ID); ObjectTypeDB::bind_method(_MD("get_process_ID"),&_OS::get_process_ID);

View file

@ -123,7 +123,8 @@ public:
bool is_in_low_processor_usage_mode() const; bool is_in_low_processor_usage_mode() const;
String get_executable_path() const; String get_executable_path() const;
int execute(const String& p_path, const Vector<String> & p_arguments,bool p_blocking); int execute(const String& p_path, const Vector<String> & p_arguments,bool p_blocking,Array p_output=Array());
Error kill(int p_pid); Error kill(int p_pid);
Error shell_open(String p_uri); Error shell_open(String p_uri);