summaryrefslogtreecommitdiff
path: root/Source/Applications
diff options
context:
space:
mode:
authorAlexis211 <alexis211@gmail.com>2009-10-24 22:58:28 +0200
committerAlexis211 <alexis211@gmail.com>2009-10-24 22:58:28 +0200
commitd1ac6fb03e3110e35023f60f643f0c4d02c3d8b6 (patch)
treeb7f693ab8ea9d320f5bd1b838e8eb3d3bcd690f4 /Source/Applications
parentb639b99b3e8f4cf77560d8d473b13d992ac8eb10 (diff)
downloadMelon-d1ac6fb03e3110e35023f60f643f0c4d02c3d8b6.tar.gz
Melon-d1ac6fb03e3110e35023f60f643f0c4d02c3d8b6.zip
More work on syscalls : userland applications can run other apps.
Diffstat (limited to 'Source/Applications')
-rw-r--r--Source/Applications/Shell/Shell-fs.ns.cpp21
-rw-r--r--Source/Applications/Shell/Shell.ns.cpp5
-rw-r--r--Source/Applications/Shell/Shell.ns.h1
3 files changed, 25 insertions, 2 deletions
diff --git a/Source/Applications/Shell/Shell-fs.ns.cpp b/Source/Applications/Shell/Shell-fs.ns.cpp
index 1d52836..cd9de8a 100644
--- a/Source/Applications/Shell/Shell-fs.ns.cpp
+++ b/Source/Applications/Shell/Shell-fs.ns.cpp
@@ -1,5 +1,6 @@
#include "Shell.ns.h"
#include <TextFile.class.h>
+#include <Binding/Process.class.h>
namespace Shell {
@@ -112,4 +113,24 @@ void wf(Vector<String>& args) {
}
}
+void run(Vector<String>& args) {
+ if (args.size() == 1) {
+ outvt << "Nothing to run...\n";
+ } else {
+ Process p = Process::run(args[1]);
+ if (p.valid()) {
+ p.setInVT(invt);
+ p.setOutVT(outvt);
+ for (u32int i = 2; i < args.size(); i++) {
+ p.pushArg(args[i]);
+ }
+ p.start();
+ s32int v = p.wait();
+ outvt << "Return value : " << (s64int)v << "\n";
+ } else {
+ outvt << "Error while launching process.\n";
+ }
+ }
+}
+
}
diff --git a/Source/Applications/Shell/Shell.ns.cpp b/Source/Applications/Shell/Shell.ns.cpp
index 7213094..cd091d5 100644
--- a/Source/Applications/Shell/Shell.ns.cpp
+++ b/Source/Applications/Shell/Shell.ns.cpp
@@ -16,8 +16,9 @@ u32int run() {
{"pwd", pwd},
{"rm", rm},
{"mkdir", mkdir},
- {"cat", cat},
- {"wf", wf},
+ {"cat", cat},
+ {"wf", wf},
+ {"run", run},
{"", 0}
};
diff --git a/Source/Applications/Shell/Shell.ns.h b/Source/Applications/Shell/Shell.ns.h
index a22c18d..b2dd587 100644
--- a/Source/Applications/Shell/Shell.ns.h
+++ b/Source/Applications/Shell/Shell.ns.h
@@ -14,4 +14,5 @@ namespace Shell {
extern void mkdir(Vector<String>& args);
extern void cat(Vector<String>& args);
extern void wf(Vector<String>& args);
+ extern void run(Vector<String>& args);
}