-
-
Notifications
You must be signed in to change notification settings - Fork 161
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
Running commands on Windows is broken #387
Comments
For what I can tell, the problem lies in Aruba:Processes:SpawnProcess. In the start method we have:
command_string is of type Aruba:Platforms:WindowsCommandString. Prior to calling to_a on this command string, it looks for example like this (which is correct):
After to_a it is: ["C:WindowsSystem32cmd.exe", "/c", "C:Ruby200-x64binbundle.bat"] Notice that the path separator '' is gone. I think the problem is that WindowsCommandString uses Ruby's Shellwords.split to process the command line. AFAIU Shellwords should/can only be used for bash. It won't work on Windows. In particular it seems to tread '' as an escape character. This leads then in the end to the error of "The system cannot find the file specified". |
I tried to temporarily modify WindowsCommandString.to_a to do something like |
Another minor detail. Here:
the variable 'commandline' is used which is not defined, creating a misleading error. It should be command_string instead. |
Great! Thanks for the hint. Can you help me and send a PR fixing it? |
This might be helpful
Not sure whether it is worth introducing a new dependency, but if all that's needed is the split functionality it could be taken from there!? |
No problem, I can guide you.
Ah. Ok.
I would prefer to take over the bits we need. The gem is MIT-licensed so we don't have a problem here. That was fixed for the Unix/Linux part already with #357. So we forgot this bit.
Mmmh... Sure. That's a problem. Do you have a good idea how to implement it in a nice way? I would like to see Windows and Unix CommandString to be implemented quite similar. Maybe just add a
Yes, it reads the script and output its for debugging purposes when the correct announcer is given. I think it was
Maybe. The windows support is still quite "brittle". |
I cannot promise anything, but maybe I can give a quick try... |
Yay. That would be great. |
Rather than starting something new...and a bit long... I'm a relative newbie with Ruby. I'm an Old FORTRAN Programmer (and other things OFP can stand for). I use FRUIT to build tests for FORTRAN and it is Ruby based so I've gotten a bit into Ruby. I'd really like to use cucumber and aruba on Windows but.... Here is what I've found so far. First problem: Trying to setup a simple CLI program with GLI and the book 'Build Awesome Command-Line Applications in Ruby 2', I try to run the basic infrastructure setup by GLI with cucumber and I get: ` Scenario: App just runs # features/todo.feature:7 Failing Scenarios: 1 scenario (1 failed)
I changed them to look like this: There are probably others for things like LIB and such. ` Scenario: App just runs # features/todo.feature:7 Failing Scenarios: 1 scenario (1 failed) C:\Work\Awesome_Cmd_Line_Apps\TODO_pgm\todo> `Second problem: I run cucumber and get `Feature: Aruba Console Background: # features/console.feature:3 Scenario: Start console # features/console.feature:6 `I've chased it a bit but haven't found why 'cmd' is undefined. I'd be happy if the basic run commands worked. There are things that might never work but it should be possible to make some of it work. |
Is there a previous version of aruba that worked on Windows? |
Like @jpc2 I am running into:
Though, I'm not sure if that is the same issue the original poster was referring to? Looking at the source I don't understand why it would ever claim |
This pull request fixed the issue for me: #422 |
We are using Aruba 0.8.1 on Windows and Linux - we have had to make local
changes to the gem to get that to work though. We also use JRuby rather
than "Matz" Ruby because we are testing a java program and use the sequel
gem and JDBC database drivers.
Here is a snippet from the docs that we give to new developers and testers:
Right now, there is a bug in Aruba 0.8.1 on Windows that requires manually
editing one of the files in that gem.
using notepad++ or similar, edit
c:\Jrubyxxx\lib\ruby\gems\shared\geams\aruba-0.8.1\lib\aruba\processes\spawn_process.rb
On line 45, change the run! method.
def run!
# rubocop:disable Metrics/LineLength
my_path = environment['PATH'][0..-2] + File::PATH_SEPARATOR +
environment['Path']
environment['PATH'] = my_path
fail LaunchError, %(Command "#{command}" not found in PATH-variable
"#{my_path}".) unless which(command, my_path)
# rubocop:enable Metrics/LineLength
@process = ChildProcess.build(which(command, my_path), *arguments)
@out = Tempfile.new("aruba-out")
@err = Tempfile.new("aruba-err")
@exit_status = nil
@duplex = true
before_run
…On Wed, Jan 4, 2017 at 8:54 AM, Thomas Thomassen ***@***.***> wrote:
Like @jpc2 <https://github.com/jpc2> I am running into undefined local
variable or methodcmd' for #Aruba::Processes::SpawnProcess:0x3df8750
(NameError)`.
Though, I'm not sure if that is the same issue the original poster was
referring to?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#387 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAk86l6G3ZGYf54c8hiXV2aMZnYOxRS9ks5rO7KZgaJpZM4IZai3>
.
|
Fix running commands on Windows (#387)
Summary
Running commands on windows seems to be broken. Have look at this build. Anyone using Ruby on Windows is welcome to help us fixing this.
Expected Behavior
Commands should be run on Windows.
Current Behavior
Running commands fails on AppVeyor CI.
Possible Solution
Fix code to run commands.
Steps to Reproduce (for bugs)
See CI Build
Context
Your Environment
The text was updated successfully, but these errors were encountered: