mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
Make shell pretend to be an interactive shell
This commit is contained in:
@@ -3554,14 +3554,19 @@ public class PApplet implements PConstants {
|
||||
static public int shell(StringList stdout, StringList stderr, String... args) {
|
||||
String shell;
|
||||
String runCmd;
|
||||
StringList argList = new StringList();
|
||||
if (platform == WINDOWS) {
|
||||
shell = System.getenv("COMSPEC");
|
||||
runCmd = "/C";
|
||||
} else {
|
||||
shell = "/bin/sh";
|
||||
runCmd = "-c";
|
||||
// attempt emulate the behavior of an interactive shell
|
||||
// can't use -i or -l since the version of bash shipped with macOS does not support this together with -c
|
||||
// also we want to make sure no motd or similar gets returned as stdout
|
||||
argList.append("if [ -f /etc/profile ]; then . /etc/profile >/dev/null 2>&1; fi;");
|
||||
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;");
|
||||
}
|
||||
StringList argList = new StringList();
|
||||
for (String arg : args) {
|
||||
argList.append(arg);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user