Package org.jruby.util
Class ShellLauncher
java.lang.Object
org.jruby.util.ShellLauncher
This mess of a class is what happens when all Java gives you is
Runtime.getRuntime().exec(). Thanks dude, that really helped.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classstatic classprivate static interfacestatic classprivate static interfaceprivate static classprivate static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final booleanprivate static final String[]private static final Stringprivate static final ShellLauncher.PidGetterprivate static final Classprivate static final Fieldprivate static final Patternprivate static final Classprivate static final Fieldprivate static final Patternprivate static final String[]private static final String[] -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static String[]arrayOfLength(String[] ary, int len) static ProcessbuildProcess(Ruby runtime, String[] args, String[] env, File pwd) static StringchangeDirInsideJar(Ruby runtime, String arg) private static booleanchangeDirInsideJar(Ruby runtime, String[] args) static intexecAndWait(Ruby runtime, IRubyObject[] rawArgs) static intexecAndWait(Ruby runtime, IRubyObject[] rawArgs, Map mergeEnv) private static String[]expandGlobs(Ruby runtime, String[] originalArgs) private static booleanfilenameIsPathSearchable(String fname, boolean forExec) static FilefindPathExecutable(Ruby runtime, String fname) static FilefindPathExecutable(Ruby runtime, String fname, IRubyObject pathObject) private static FilefindPathFile(Ruby runtime, String fname, String[] path, boolean isExec) static String[]getCurrentEnv(Ruby runtime) private static String[]getCurrentEnv(Ruby runtime, Map mergeEnv) static String[]getModifiedEnv(Ruby runtime, Collection mergeEnv, boolean clearEnv) private static StringgetPathEntry(RubyArray initArray) static longgetPidFromProcess(Process process) private static Stringprivate static voidhandleStreams(Ruby runtime, Process p, InputStream in, OutputStream out, OutputStream err) private static voidhandleStreamsNonblocking(Ruby runtime, Process p, OutputStream out, OutputStream err) private static booleanhasGlobCharacter(String word) private static booleanhasLeadingArgvArray(IRubyObject[] rawArgs) Takes an argument array suitable for Kernel#exec or similar, and indicates whether it has a leading two-element array giving the path and argv[0] entries separately.private static FileisValidFile(Ruby runtime, String fname, boolean isExec) private static FileisValidFile(Ruby runtime, String fdir, String fname, boolean isExec) (package private) static voidprivate static String[]parseCommandLine(ThreadContext context, Ruby runtime, IRubyObject[] rawArgs) static ShellLauncher.POpenProcesspopen(Ruby runtime, IRubyObject[] strings, Map env, IOOptions modes) Deprecated.static ShellLauncher.POpenProcesspopen(Ruby runtime, IRubyObject[] strings, Map env, ModeFlags modes) static ShellLauncher.POpenProcesspopen(Ruby runtime, IRubyObject string, Map env, ModeFlags modes) static ShellLauncher.POpenProcesspopen(Ruby runtime, IRubyObject string, IOOptions modes) Deprecated.static ShellLauncher.POpenProcesspopen(Ruby runtime, IRubyObject string, ModeFlags modes) static ShellLauncher.POpenProcesspopen3(Ruby runtime, IRubyObject[] strings) Deprecated.static ShellLauncher.POpenProcesspopen3(Ruby runtime, IRubyObject[] strings, boolean addShell) Deprecated.private static ProcesspopenShared(Ruby runtime, IRubyObject[] strings) private static ProcesspopenShared(Ruby runtime, IRubyObject[] strings, Map env) private static ProcesspopenShared(Ruby runtime, IRubyObject[] strings, Map env, boolean addShell) static longreflectPidFromProcess(Process process) static Processrun(Ruby runtime, Map env, String dir, IRubyObject[] rawArgs, boolean doExecutableSearch, boolean forceExternalProcess) static Processrun(Ruby runtime, IRubyObject string) static Processrun(Ruby runtime, IRubyObject[] rawArgs, boolean doExecutableSearch) static Processrun(Ruby runtime, IRubyObject[] rawArgs, boolean doExecutableSearch, boolean forceExternalProcess) static intrunAndWait(Ruby runtime, IRubyObject[] rawArgs) static intrunAndWait(Ruby runtime, IRubyObject[] rawArgs, OutputStream output) static intrunAndWait(Ruby runtime, IRubyObject[] rawArgs, OutputStream output, boolean doExecutableSearch) static long[]runAndWaitPid(Ruby runtime, IRubyObject[] rawArgs) static long[]runAndWaitPid(Ruby runtime, IRubyObject[] rawArgs, OutputStream output, boolean doExecutableSearch) static longrunExternal(Ruby runtime, IRubyObject env, IRubyObject prog, IRubyObject options, IRubyObject args, boolean wait) static intrunExternalAndWait(Ruby runtime, IRubyObject[] rawArgs, Map mergeEnv) static longrunExternalWithoutWait(Ruby runtime, IRubyObject[] rawArgs) static longrunExternalWithoutWait(Ruby runtime, IRubyObject env, IRubyObject prog, IRubyObject options, IRubyObject args) static longrunWithoutWait(Ruby runtime, IRubyObject[] rawArgs) private static longrunWithoutWait(Ruby runtime, IRubyObject[] rawArgs, OutputStream output) static booleanshouldUseShell(String command) private static Filestatic InputStreamunwrapBufferedStream(InputStream filteredStream) Deprecated.static OutputStreamunwrapBufferedStream(OutputStream filteredStream) Deprecated.static InputStreamunwrapFilterInputStream(InputStream filteredStream) Deprecated.static OutputStreamunwrapFilterOutputStream(OutputStream filteredStream) Deprecated.private static booleanwithExeSuffix(String fname)
-
Field Details
-
DEBUG
private static final boolean DEBUG- See Also:
-
PATH_ENV
- See Also:
-
DEFAULT_PATH
-
WINDOWS_EXE_SUFFIXES
-
WINDOWS_INTERNAL_CMDS
-
SHELL_METACHARACTER_PATTERN
-
WIN_ENVVAR_PATTERN
-
UNIXProcess
-
UNIXProcess_pid
-
ProcessImpl
-
ProcessImpl_handle
-
PID_GETTER
-
-
Constructor Details
-
ShellLauncher
public ShellLauncher()
-
-
Method Details
-
getCurrentEnv
-
getCurrentEnv
-
getModifiedEnv
-
arrayOfLength
-
filenameIsPathSearchable
-
tryFile
-
withExeSuffix
-
isValidFile
-
isValidFile
-
findPathFile
-
findPathExecutable
-
findPathExecutable
-
runAndWait
-
runAndWaitPid
-
runWithoutWait
-
runExternalAndWait
-
runExternalWithoutWait
public static long runExternalWithoutWait(Ruby runtime, IRubyObject env, IRubyObject prog, IRubyObject options, IRubyObject args) -
runExternal
public static long runExternal(Ruby runtime, IRubyObject env, IRubyObject prog, IRubyObject options, IRubyObject args, boolean wait) -
changeDirInsideJar
-
changeDirInsideJar
-
buildProcess
public static Process buildProcess(Ruby runtime, String[] args, String[] env, File pwd) throws IOException - Throws:
IOException
-
runExternalWithoutWait
-
execAndWait
-
execAndWait
-
runAndWait
-
runAndWait
public static int runAndWait(Ruby runtime, IRubyObject[] rawArgs, OutputStream output, boolean doExecutableSearch) -
runAndWaitPid
public static long[] runAndWaitPid(Ruby runtime, IRubyObject[] rawArgs, OutputStream output, boolean doExecutableSearch) -
runWithoutWait
-
getPidFromProcess
-
reflectPidFromProcess
-
run
- Throws:
IOException
-
popen
public static ShellLauncher.POpenProcess popen(Ruby runtime, IRubyObject string, ModeFlags modes) throws IOException - Throws:
IOException
-
popen
public static ShellLauncher.POpenProcess popen(Ruby runtime, IRubyObject[] strings, Map env, ModeFlags modes) throws IOException - Throws:
IOException
-
popen
public static ShellLauncher.POpenProcess popen(Ruby runtime, IRubyObject string, Map env, ModeFlags modes) throws IOException - Throws:
IOException
-
popen
@Deprecated public static ShellLauncher.POpenProcess popen(Ruby runtime, IRubyObject string, IOOptions modes) throws IOException Deprecated.- Throws:
IOException
-
popen
@Deprecated public static ShellLauncher.POpenProcess popen(Ruby runtime, IRubyObject[] strings, Map env, IOOptions modes) throws IOException Deprecated.- Throws:
IOException
-
popen3
@Deprecated public static ShellLauncher.POpenProcess popen3(Ruby runtime, IRubyObject[] strings) throws IOException Deprecated.- Throws:
IOException
-
popen3
@Deprecated public static ShellLauncher.POpenProcess popen3(Ruby runtime, IRubyObject[] strings, boolean addShell) throws IOException Deprecated.- Throws:
IOException
-
run
public static Process run(Ruby runtime, IRubyObject[] rawArgs, boolean doExecutableSearch) throws IOException - Throws:
IOException
-
hasGlobCharacter
-
expandGlobs
-
run
public static Process run(Ruby runtime, IRubyObject[] rawArgs, boolean doExecutableSearch, boolean forceExternalProcess) throws IOException - Throws:
IOException
-
run
public static Process run(Ruby runtime, Map env, String dir, IRubyObject[] rawArgs, boolean doExecutableSearch, boolean forceExternalProcess) throws IOException - Throws:
IOException
-
handleStreams
private static void handleStreams(Ruby runtime, Process p, InputStream in, OutputStream out, OutputStream err) throws IOException - Throws:
IOException
-
handleStreamsNonblocking
private static void handleStreamsNonblocking(Ruby runtime, Process p, OutputStream out, OutputStream err) throws IOException - Throws:
IOException
-
parseCommandLine
private static String[] parseCommandLine(ThreadContext context, Ruby runtime, IRubyObject[] rawArgs) -
hasLeadingArgvArray
Takes an argument array suitable for Kernel#exec or similar, and indicates whether it has a leading two-element array giving the path and argv[0] entries separately. We can't use the argv[0] entry through ProcessBuilder, so we discard it. -
getPathEntry
-
getShell
-
shouldUseShell
-
log
-
unwrapBufferedStream
Deprecated. -
unwrapBufferedStream
Deprecated. -
unwrapFilterOutputStream
Deprecated. -
unwrapFilterInputStream
Deprecated.
-