MCPcopy Index your code
hub / github.com/benfry/processing4 / shell

Method shell

core/src/processing/core/PApplet.java:3266–3286  ·  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

3264 * Same as exec() above, but prefixes the call with a shell.
3265 */
3266 static public int shell(StringList stdout, StringList stderr, String... args) {
3267 String shell;
3268 String runCmd;
3269 StringList argList = new StringList();
3270 if (platform == WINDOWS) {
3271 shell = System.getenv("COMSPEC");
3272 runCmd = "/C";
3273 } else {
3274 shell = "/bin/sh";
3275 runCmd = "-c";
3276 // attempt to emulate the behavior of an interactive shell
3277 // can't use -i or -l since the version of bash shipped with macOS does not support this together with -c
3278 // also we want to make sure no motd or similar gets returned as stdout
3279 argList.append("if [ -f /etc/profile ]; then . /etc/profile >/dev/null 2>&1; fi;");
3280 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;");
3281 }
3282 for (String arg : args) {
3283 argList.append(arg);
3284 }
3285 return exec(stdout, stderr, shell, runCmd, argList.join(" "));
3286 }
3287
3288
3289 /*

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