File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3482,6 +3482,27 @@ static public Process launch(String... args) {
34823482 }
34833483
34843484
3485+ /**
3486+ * Pass a set of arguments directly to the command line. Uses Java's
3487+ * <A HREF="https://docs.oracle.com/javase/8/docs/api/java/lang/Runtime.html#exec-java.lang.String:A-">Runtime.exec()</A>
3488+ * method. This is different from the <A HREF="https://processing.org/reference/launch_.html">launch()</A>
3489+ * method, which uses the operating system's launcher to open the files.
3490+ * It's always a good idea to use a full path to the executable here.
3491+ * <pre>
3492+ * exec("/usr/bin/say", "-v", "Pipe Organ", "welcome to the command line");
3493+ * </pre>
3494+ * Or if you want to wait until it's completed, something like this:
3495+ * <pre>
3496+ * Process p = exec("/usr/bin/say", "waiting until done");
3497+ * try {
3498+ * int result = p.waitFor();
3499+ * println("the process returned " + result);
3500+ * } catch (InterruptedException e) { }
3501+ * </pre>
3502+ * You can also get the system output and error streams from the Process
3503+ * object, but that's more that we'd like to cover here.
3504+ * @return a <A HREF="https://docs.oracle.com/javase/8/docs/api/java/lang/Process.html">Process</A> object
3505+ */
34853506 static public Process exec (String ... args ) {
34863507 try {
34873508 return Runtime .getRuntime ().exec (args );
You can’t perform that action at this time.
0 commit comments