public class ShellLauncher
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
private static class |
ShellLauncher.ChannelPumper |
static class |
ShellLauncher.LaunchConfig |
private static interface |
ShellLauncher.PidGetter |
static class |
ShellLauncher.POpenProcess |
private static interface |
ShellLauncher.Pumper |
private static class |
ShellLauncher.ScriptThreadProcess |
private static class |
ShellLauncher.StreamPumper |
| Modifier and Type | Field and Description |
|---|---|
private static boolean |
DEBUG |
private static java.lang.String[] |
DEFAULT_PATH |
private static java.lang.String |
PATH_ENV |
private static ShellLauncher.PidGetter |
PID_GETTER |
private static java.lang.Class |
ProcessImpl |
private static java.lang.reflect.Field |
ProcessImpl_handle |
private static java.util.regex.Pattern |
SHELL_METACHARACTER_PATTERN |
private static java.lang.Class |
UNIXProcess |
private static java.lang.reflect.Field |
UNIXProcess_pid |
private static java.util.regex.Pattern |
WIN_ENVVAR_PATTERN |
private static java.lang.String[] |
WINDOWS_EXE_SUFFIXES |
private static java.lang.String[] |
WINDOWS_INTERNAL_CMDS |
| Constructor and Description |
|---|
ShellLauncher() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.Process |
buildProcess(Ruby runtime,
java.lang.String[] args,
java.lang.String[] env,
java.io.File pwd) |
static int |
execAndWait(Ruby runtime,
IRubyObject[] rawArgs) |
static int |
execAndWait(Ruby runtime,
IRubyObject[] rawArgs,
java.util.Map mergeEnv) |
private static java.lang.String[] |
expandGlobs(Ruby runtime,
java.lang.String[] originalArgs) |
private static boolean |
filenameIsPathSearchable(java.lang.String fname,
boolean forExec) |
private static java.io.File |
findPathExecutable(Ruby runtime,
java.lang.String fname) |
private static java.io.File |
findPathFile(Ruby runtime,
java.lang.String fname,
java.lang.String[] path,
boolean isExec) |
static java.lang.String[] |
getCurrentEnv(Ruby runtime) |
private static java.lang.String[] |
getCurrentEnv(Ruby runtime,
java.util.Map mergeEnv) |
private static java.lang.String |
getPathEntry(RubyArray initArray) |
static long |
getPidFromProcess(java.lang.Process process) |
private static java.lang.String |
getShell(Ruby runtime) |
private static void |
handleStreams(Ruby runtime,
java.lang.Process p,
java.io.InputStream in,
java.io.OutputStream out,
java.io.OutputStream err) |
private static void |
handleStreamsNonblocking(Ruby runtime,
java.lang.Process p,
java.io.OutputStream out,
java.io.OutputStream err) |
private static boolean |
hasGlobCharacter(java.lang.String word) |
private static boolean |
hasLeadingArgvArray(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 java.io.File |
isValidFile(Ruby runtime,
java.lang.String fname,
boolean isExec) |
private static java.io.File |
isValidFile(Ruby runtime,
java.lang.String fdir,
java.lang.String fname,
boolean isExec) |
(package private) static void |
log(Ruby runtime,
java.lang.String msg) |
private static java.lang.String[] |
parseCommandLine(ThreadContext context,
Ruby runtime,
IRubyObject[] rawArgs) |
static ShellLauncher.POpenProcess |
popen(Ruby runtime,
IRubyObject[] strings,
java.util.Map env,
IOOptions modes)
Deprecated.
|
static ShellLauncher.POpenProcess |
popen(Ruby runtime,
IRubyObject[] strings,
java.util.Map env,
ModeFlags modes) |
static ShellLauncher.POpenProcess |
popen(Ruby runtime,
IRubyObject string,
IOOptions modes)
Deprecated.
|
static ShellLauncher.POpenProcess |
popen(Ruby runtime,
IRubyObject string,
java.util.Map env,
ModeFlags modes) |
static ShellLauncher.POpenProcess |
popen(Ruby runtime,
IRubyObject string,
ModeFlags modes) |
static ShellLauncher.POpenProcess |
popen3(Ruby runtime,
IRubyObject[] strings) |
static ShellLauncher.POpenProcess |
popen3(Ruby runtime,
IRubyObject[] strings,
boolean addShell) |
private static java.lang.Process |
popenShared(Ruby runtime,
IRubyObject[] strings) |
private static java.lang.Process |
popenShared(Ruby runtime,
IRubyObject[] strings,
java.util.Map env) |
private static java.lang.Process |
popenShared(Ruby runtime,
IRubyObject[] strings,
java.util.Map env,
boolean addShell) |
static long |
reflectPidFromProcess(java.lang.Process process) |
static java.lang.Process |
run(Ruby runtime,
IRubyObject string) |
static java.lang.Process |
run(Ruby runtime,
IRubyObject[] rawArgs,
boolean doExecutableSearch) |
static java.lang.Process |
run(Ruby runtime,
IRubyObject[] rawArgs,
boolean doExecutableSearch,
boolean forceExternalProcess) |
static int |
runAndWait(Ruby runtime,
IRubyObject[] rawArgs) |
static int |
runAndWait(Ruby runtime,
IRubyObject[] rawArgs,
java.io.OutputStream output) |
static int |
runAndWait(Ruby runtime,
IRubyObject[] rawArgs,
java.io.OutputStream output,
boolean doExecutableSearch) |
static long[] |
runAndWaitPid(Ruby runtime,
IRubyObject[] rawArgs) |
static long[] |
runAndWaitPid(Ruby runtime,
IRubyObject[] rawArgs,
java.io.OutputStream output,
boolean doExecutableSearch) |
static long |
runExternal(Ruby runtime,
IRubyObject env,
IRubyObject prog,
IRubyObject options,
IRubyObject args,
boolean wait) |
static int |
runExternalAndWait(Ruby runtime,
IRubyObject[] rawArgs,
java.util.Map mergeEnv) |
static long |
runExternalWithoutWait(Ruby runtime,
IRubyObject[] rawArgs) |
private static long |
runExternalWithoutWait(Ruby runtime,
IRubyObject[] rawArgs,
java.io.OutputStream output) |
static long |
runExternalWithoutWait(Ruby runtime,
IRubyObject env,
IRubyObject prog,
IRubyObject options,
IRubyObject args) |
static long |
runWithoutWait(Ruby runtime,
IRubyObject[] rawArgs) |
private static long |
runWithoutWait(Ruby runtime,
IRubyObject[] rawArgs,
java.io.OutputStream output) |
static boolean |
shouldUseShell(java.lang.String command) |
private static java.io.File |
tryFile(Ruby runtime,
java.lang.String fdir,
java.lang.String fname) |
static java.io.InputStream |
unwrapBufferedStream(java.io.InputStream filteredStream)
Unwrap all filtering streams between the given stream and its actual
unfiltered stream.
|
static java.io.OutputStream |
unwrapBufferedStream(java.io.OutputStream filteredStream)
Unwrap all filtering streams between the given stream and its actual
unfiltered stream.
|
private static boolean |
withExeSuffix(java.lang.String fname) |
private static final boolean DEBUG
private static final java.lang.String PATH_ENV
private static final java.lang.String[] DEFAULT_PATH
private static final java.lang.String[] WINDOWS_EXE_SUFFIXES
private static final java.lang.String[] WINDOWS_INTERNAL_CMDS
private static final java.util.regex.Pattern SHELL_METACHARACTER_PATTERN
private static final java.util.regex.Pattern WIN_ENVVAR_PATTERN
private static final java.lang.Class UNIXProcess
private static final java.lang.reflect.Field UNIXProcess_pid
private static final java.lang.Class ProcessImpl
private static final java.lang.reflect.Field ProcessImpl_handle
private static final ShellLauncher.PidGetter PID_GETTER
public static java.lang.String[] getCurrentEnv(Ruby runtime)
private static java.lang.String[] getCurrentEnv(Ruby runtime, java.util.Map mergeEnv)
private static boolean filenameIsPathSearchable(java.lang.String fname,
boolean forExec)
private static java.io.File tryFile(Ruby runtime, java.lang.String fdir, java.lang.String fname)
private static boolean withExeSuffix(java.lang.String fname)
private static java.io.File isValidFile(Ruby runtime, java.lang.String fdir, java.lang.String fname, boolean isExec)
private static java.io.File isValidFile(Ruby runtime, java.lang.String fname, boolean isExec)
private static java.io.File findPathFile(Ruby runtime, java.lang.String fname, java.lang.String[] path, boolean isExec)
private static java.io.File findPathExecutable(Ruby runtime, java.lang.String fname)
public static int runAndWait(Ruby runtime, IRubyObject[] rawArgs)
public static long[] runAndWaitPid(Ruby runtime, IRubyObject[] rawArgs)
public static long runWithoutWait(Ruby runtime, IRubyObject[] rawArgs)
public static int runExternalAndWait(Ruby runtime, IRubyObject[] rawArgs, java.util.Map mergeEnv)
public static long runExternalWithoutWait(Ruby runtime, IRubyObject env, IRubyObject prog, IRubyObject options, IRubyObject args)
public static long runExternal(Ruby runtime, IRubyObject env, IRubyObject prog, IRubyObject options, IRubyObject args, boolean wait)
public static java.lang.Process buildProcess(Ruby runtime, java.lang.String[] args, java.lang.String[] env, java.io.File pwd) throws java.io.IOException
java.io.IOExceptionpublic static long runExternalWithoutWait(Ruby runtime, IRubyObject[] rawArgs)
public static int execAndWait(Ruby runtime, IRubyObject[] rawArgs)
public static int execAndWait(Ruby runtime, IRubyObject[] rawArgs, java.util.Map mergeEnv)
public static int runAndWait(Ruby runtime, IRubyObject[] rawArgs, java.io.OutputStream output)
public static int runAndWait(Ruby runtime, IRubyObject[] rawArgs, java.io.OutputStream output, boolean doExecutableSearch)
public static long[] runAndWaitPid(Ruby runtime, IRubyObject[] rawArgs, java.io.OutputStream output, boolean doExecutableSearch)
private static long runWithoutWait(Ruby runtime, IRubyObject[] rawArgs, java.io.OutputStream output)
private static long runExternalWithoutWait(Ruby runtime, IRubyObject[] rawArgs, java.io.OutputStream output)
public static long getPidFromProcess(java.lang.Process process)
public static long reflectPidFromProcess(java.lang.Process process)
public static java.lang.Process run(Ruby runtime, IRubyObject string) throws java.io.IOException
java.io.IOExceptionpublic static ShellLauncher.POpenProcess popen(Ruby runtime, IRubyObject string, ModeFlags modes) throws java.io.IOException
java.io.IOExceptionpublic static ShellLauncher.POpenProcess popen(Ruby runtime, IRubyObject[] strings, java.util.Map env, ModeFlags modes) throws java.io.IOException
java.io.IOExceptionpublic static ShellLauncher.POpenProcess popen(Ruby runtime, IRubyObject string, java.util.Map env, ModeFlags modes) throws java.io.IOException
java.io.IOException@Deprecated public static ShellLauncher.POpenProcess popen(Ruby runtime, IRubyObject string, IOOptions modes) throws java.io.IOException
java.io.IOException@Deprecated public static ShellLauncher.POpenProcess popen(Ruby runtime, IRubyObject[] strings, java.util.Map env, IOOptions modes) throws java.io.IOException
java.io.IOExceptionpublic static ShellLauncher.POpenProcess popen3(Ruby runtime, IRubyObject[] strings) throws java.io.IOException
java.io.IOExceptionpublic static ShellLauncher.POpenProcess popen3(Ruby runtime, IRubyObject[] strings, boolean addShell) throws java.io.IOException
java.io.IOExceptionprivate static java.lang.Process popenShared(Ruby runtime, IRubyObject[] strings) throws java.io.IOException
java.io.IOExceptionprivate static java.lang.Process popenShared(Ruby runtime, IRubyObject[] strings, java.util.Map env) throws java.io.IOException
java.io.IOExceptionprivate static java.lang.Process popenShared(Ruby runtime, IRubyObject[] strings, java.util.Map env, boolean addShell) throws java.io.IOException
java.io.IOExceptionpublic static java.io.OutputStream unwrapBufferedStream(java.io.OutputStream filteredStream)
filteredStream - The stream to unwrappublic static java.io.InputStream unwrapBufferedStream(java.io.InputStream filteredStream)
filteredStream - The stream to unwrappublic static java.lang.Process run(Ruby runtime, IRubyObject[] rawArgs, boolean doExecutableSearch) throws java.io.IOException
java.io.IOExceptionprivate static boolean hasGlobCharacter(java.lang.String word)
private static java.lang.String[] expandGlobs(Ruby runtime, java.lang.String[] originalArgs)
public static java.lang.Process run(Ruby runtime, IRubyObject[] rawArgs, boolean doExecutableSearch, boolean forceExternalProcess) throws java.io.IOException
java.io.IOExceptionprivate static void handleStreams(Ruby runtime, java.lang.Process p, java.io.InputStream in, java.io.OutputStream out, java.io.OutputStream err) throws java.io.IOException
java.io.IOExceptionprivate static void handleStreamsNonblocking(Ruby runtime, java.lang.Process p, java.io.OutputStream out, java.io.OutputStream err) throws java.io.IOException
java.io.IOExceptionprivate static java.lang.String[] parseCommandLine(ThreadContext context, Ruby runtime, IRubyObject[] rawArgs)
private static boolean hasLeadingArgvArray(IRubyObject[] rawArgs)
private static java.lang.String getPathEntry(RubyArray initArray)
private static java.lang.String getShell(Ruby runtime)
public static boolean shouldUseShell(java.lang.String command)
static void log(Ruby runtime, java.lang.String msg)