MCPcopy Index your code
hub / github.com/processing/processing / shell

Method shell

core/src/processing/core/PApplet.java:3678–3698  ·  view source on GitHub ↗

Same as exec() above, but prefixes the call with a shell.

(StringList stdout, StringList stderr, String... args)

Source from the content-addressed store, hash-verified

3676 * Same as exec() above, but prefixes the call with a shell.
3677 */
3678 static public int shell(StringList stdout, StringList stderr, String... args) {
3679 String shell;
3680 String runCmd;
3681 StringList argList = new StringList();
3682 if (platform == WINDOWS) {
3683 shell = System.getenv("COMSPEC");
3684 runCmd = "/C";
3685 } else {
3686 shell = "/bin/sh";
3687 runCmd = "-c";
3688 // attempt emulate the behavior of an interactive shell
3689 // can't use -i or -l since the version of bash shipped with macOS does not support this together with -c
3690 // also we want to make sure no motd or similar gets returned as stdout
3691 argList.append("if [ -f /etc/profile ]; then . /etc/profile >/dev/null 2>&1; fi;");
3692 argList.append("if [ -f ~/.bash_profile ]; then . ~/.bash_profile >/dev/null 2>&1; elif [ -f ~/.bash_profile ]; then . ~/.bash_profile >/dev/null 2>&1; elif [ -f ~/.profile ]; then ~/.profile >/dev/null 2>&1; fi;");
3693 }
3694 for (String arg : args) {
3695 argList.append(arg);
3696 }
3697 return exec(stdout, stderr, shell, runCmd, argList.join(" "));
3698 }
3699
3700
3701 /*

Callers

nothing calls this directly

Calls 4

appendMethod · 0.95
execMethod · 0.95
joinMethod · 0.95
getenvMethod · 0.65

Tested by

no test coverage detected