Issue title: Unhandled Java exception: java.lang.ArrayIndexOutOfBoundsException: -3
 Issue body: I am new to JRuby, but I get this error running a script in a Jenkins deployment environment and it looks like it's coming from inside JRuby. Towards the end of this stack trace you see my code: deploy-capacity-manager/vendor/bundle/jruby/2.2.0/bin/ebs-deploy:23 - this is a line that calls `load Gem.bin_path('ebs-deploy', 'ebs-deploy', version)`, and when it runs that I get the following exception (JRuby 116.69.203.115, but also seen with 116.69.203.115):

```
Unhandled Java exception: java.lang.ArrayIndexOutOfBoundsException: -3
java.lang.ArrayIndexOutOfBoundsException: -3
        run_exec_dup2 at org/jruby/util/io/PopenExecutor.java:789
    execargRunOptions at org/jruby/util/io/PopenExecutor.java:986
         spawnProcess at org/jruby/util/io/PopenExecutor.java:113
        spawnInternal at org/jruby/util/io/PopenExecutor.java:93
             system19 at org/jruby/RubyKernel.java:1541
                 call at org/jruby/internal/runtime/methods/JavaMethod.java:729
         cacheAndCall at org/jruby/runtime/callsite/CachingCallSite.java:273
            callBlock at org/jruby/runtime/callsite/CachingCallSite.java:79
                 call at org/jruby/runtime/callsite/CachingCallSite.java:83
            interpret at org/jruby/ir/instructions/CallBase.java:419
          processCall at org/jruby/ir/interpreter/InterpreterEngine.java:322
            interpret at org/jruby/ir/interpreter/StartupInterpreterEngine.java:77
            interpret at org/jruby/ir/interpreter/InterpreterEngine.java:83
     INTERPRET_METHOD at org/jruby/internal/runtime/methods/MixedModeIRMethod.java:197
                 call at org/jruby/internal/runtime/methods/MixedModeIRMethod.java:183
                 call at org/jruby/internal/runtime/methods/DynamicMethod.java:197
         cacheAndCall at org/jruby/runtime/callsite/CachingCallSite.java:313
                 call at org/jruby/runtime/callsite/CachingCallSite.java:163
          processCall at org/jruby/ir/interpreter/InterpreterEngine.java:290
            interpret at org/jruby/ir/interpreter/StartupInterpreterEngine.java:77
            interpret at org/jruby/ir/interpreter/InterpreterEngine.java:77
     INTERPRET_METHOD at org/jruby/internal/runtime/methods/MixedModeIRMethod.java:162
                 call at org/jruby/internal/runtime/methods/MixedModeIRMethod.java:148
                 call at org/jruby/internal/runtime/methods/DynamicMethod.java:189
         cacheAndCall at org/jruby/runtime/callsite/CachingCallSite.java:293
                 call at org/jruby/runtime/callsite/CachingCallSite.java:131
          processCall at org/jruby/ir/interpreter/InterpreterEngine.java:306
            interpret at org/jruby/ir/interpreter/StartupInterpreterEngine.java:77
       INTERPRET_ROOT at org/jruby/ir/interpreter/Interpreter.java:102
              execute at org/jruby/ir/interpreter/Interpreter.java:89
              execute at org/jruby/ir/interpreter/Interpreter.java:32
              execute at org/jruby/ir/IRTranslator.java:42
       runInterpreter at org/jruby/Ruby.java:837
             loadFile at org/jruby/Ruby.java:2900
                 load at org/jruby/runtime/load/LibrarySearcher.java:236
                 load at org/jruby/runtime/load/LibrarySearcher.java:35
                 load at org/jruby/runtime/load/LoadService.java:336
           loadCommon at org/jruby/RubyKernel.java:965
               load19 at org/jruby/RubyKernel.java:957
                 call at org/jruby/internal/runtime/methods/DynamicMethod.java:201
                 call at org/jruby/internal/runtime/methods/DynamicMethod.java:197
         cacheAndCall at org/jruby/runtime/callsite/CachingCallSite.java:313
                 call at org/jruby/runtime/callsite/CachingCallSite.java:163
                <top> at /var/lib/jenkins/workspace/Deploy/deploy-capacity-manager/vendor/bundle/jruby/2.2.0/bin/ebs-deploy:23
  invokeWithArguments at java/lang/invoke/MethodHandle.java:599
                 load at org/jruby/ir/Compiler.java:111
            runScript at org/jruby/Ruby.java:821
            runScript at org/jruby/Ruby.java:813
          runNormally at org/jruby/Ruby.java:751
          runFromMain at org/jruby/Ruby.java:573
        doRunFromMain at org/jruby/Main.java:409
          internalRun at org/jruby/Main.java:304
                  run at org/jruby/Main.java:233
                 main at org/jruby/Main.java:200
```

 Comments: 
 Comment 0: the code assumes Java's binarySeach returns -1 when not found https://github.com/jruby/jruby/blob/master/core/src/main/java/org/jruby/util/io/PopenExecutor.java#L784 ... should be checking for any `< 0` value as invalid. this is an easy fix.
 Comment 1: Yes, a bit of experimentation suggests the actual command it executes isn't that important - the key bit is that it's a command that exits with a failure code
{'source': 'GithubIssues', 'repo_name_with_owner': 'jruby/jruby', 'issue_id': 125910973, 'repo_stars': 3645.0}