-
-
Notifications
You must be signed in to change notification settings - Fork 925
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Windows: IO.popen closes pipe when forward slash in Typeperf command #3320
Comments
The There's a block of code in the if (Platform.IS_WINDOWS) {
String commandString = _cmd.convertToString().toString().replace('/', '\\');
_cmd = runtime.newString(commandString);
if (_cmdPlusArgs != null) _cmdPlusArgs[0] = _cmd;
} else {
_cmd = _cmd.convertToString();
if (_cmdPlusArgs != null) _cmdPlusArgs[0] = _cmd;
} For example, the forward slash in the following command should not be converted to a backslash:
|
@NickMRamirez Can you try again with a newer version of JRuby 9.0.0.0 please? There were a lot of changes made since 9.0.0.0.pre2. The current release is 9.0.1.0. |
@nirvdrum I updated to jruby 9.0.1.0 (2.2.2) 2015-09-02 58f336. The problem still exists. Running: And then: IO.popen('typeperf "\Processor Information(*)\Interrupts/sec"') { |o| o.each { |line| puts line }} Displays: |
Can i do any workaround for this problem? |
@erikpar Using Open3.popen3 seemed to work, but I couldn't get my unit tests to pass when I switched to using it. But in a pinch, you might try downloading and building the logstash-input-perfmon plugin and changing the call to |
Didn't managed to make it work |
@erikpar Since JRuby's IO.popen is buggy for Windows, I have changed the logstash-input-perfmon plugin to use Open3.popen3 instead. I will push to rubygems sometime soon, but you can get the source now. |
Thanks its working :-) |
This is still a problem in JRuby |
I believe this is still an issue at least in 9.1.13.0:
|
Also the code mentioned above by @NickMRamirez is still there: https://github.com/jruby/jruby/blob/master/core/src/main/java/org/jruby/RubyIO.java#L3972-L3975 |
On Windows, the following command, which starts a never-ending process that outputs performance metrics to the console, works with ruby 2.2.2, but fails with JRuby 9.0.0.0.pre2 (2.2.2):
In ruby, this command begins outputting performance metrics. However, with JRuby, I get:
Exiting, please wait...
Error: No valid counters.
I used the IRB to test ruby and then
jruby -S irb
to test JRuby. I believe it has to do with the forward slash. Other perfmon counters that do not have a slash work, for example:Note that the forward slash is part of the counter's name and is within quotes, so it should not be counted as, for example, an argument to typeperf that begins with a forward slash.
The text was updated successfully, but these errors were encountered: