Skip to content
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

run_command_and_stop(): Windows says "The operation completed successfully.", but it did not. #902

Open
emiltin opened this issue Jun 26, 2023 · 0 comments

Comments

@emiltin
Copy link

emiltin commented Jun 26, 2023

👓 What did you see?

I understand Windows support is work-in-progress. But I still thought it might be useful to report this.

On Windows, run_command_and_stop() fails for me with "Windows says "The operation completed successfully.", but it did not".

Searching other issues, it seems this is related to the need to prepend "cmd.exe /c " to the command, and also that this was already fixed a long time in Aruba, see eg. #283.

I tried manually prepending "cmd.exe /c " on Windows, but still returns the same error.

Mac and Linux works as expected.

 1) aruba windows can run command and stop
     Failure/Error: run_command_and_stop('rspec --help', exit_timeout: 1, fail_on_error: false)

     ChildProcess::Error:
       Unknown error (Windows says "The operation completed successfully.", but it did not.)
     # ./vendor/bundle/ruby/3.2.0/gems/childprocess-4.1.0/lib/childprocess/windows/lib.rb:326:in `handle_for'
     # ./vendor/bundle/ruby/3.2.0/gems/childprocess-4.1.0/lib/childprocess/windows/process_builder.rb:141:in `std_stream_handle_for'
     # ./vendor/bundle/ruby/3.2.0/gems/childprocess-4.1.0/lib/childprocess/windows/process_builder.rb:113:in `setup_io'
     # ./vendor/bundle/ruby/3.2.0/gems/childprocess-4.1.0/lib/childprocess/windows/process_builder.rb:32:in `start'
     # ./vendor/bundle/ruby/3.2.0/gems/childprocess-4.1.0/lib/childprocess/windows/process.rb:70:in `launch_process'
     # ./vendor/bundle/ruby/3.2.0/gems/childprocess-4.1.0/lib/childprocess/abstract_process.rb:81:in `start'
     # ./vendor/bundle/ruby/3.2.0/gems/aruba-2.1.0/lib/aruba/processes/spawn_process.rb:101:in `block in start'
     # ./vendor/bundle/ruby/3.2.0/gems/aruba-2.1.0/lib/aruba/platforms/local_environment.rb:22:in `call'
     # ./vendor/bundle/ruby/3.2.0/gems/aruba-2.1.0/lib/aruba/platforms/unix_platform.rb:79:in `with_environment'
     # ./vendor/bundle/ruby/3.2.0/gems/aruba-2.1.0/lib/aruba/processes/spawn_process.rb:100:in `start'
     # ./vendor/bundle/ruby/3.2.0/gems/aruba-2.1.0/lib/aruba/command.rb:71:in `start'
     # ./vendor/bundle/ruby/3.2.0/gems/aruba-2.1.0/lib/aruba/api/commands.rb:260:in `block in start_command'
     # ./vendor/bundle/ruby/3.2.0/gems/aruba-2.1.0/lib/aruba/platforms/local_environment.rb:22:in `call'
     # ./vendor/bundle/ruby/3.2.0/gems/aruba-2.1.0/lib/aruba/platforms/unix_platform.rb:79:in `with_environment'
     # ./vendor/bundle/ruby/3.2.0/gems/aruba-2.1.0/lib/aruba/api/core.rb:222:in `block in with_environment'
     # ./vendor/bundle/ruby/3.2.0/gems/aruba-2.1.0/lib/aruba/platforms/unix_environment_variables.rb:189:in `nest'
     # ./vendor/bundle/ruby/3.2.0/gems/aruba-2.1.0/lib/aruba/api/core.rb:220:in `with_environment'
     # ./vendor/bundle/ruby/3.2.0/gems/aruba-2.1.0/lib/aruba/api/core.rb:80:in `cd'
     # ./vendor/bundle/ruby/3.2.0/gems/aruba-2.1.0/lib/aruba/api/core.rb:42:in `in_current_directory'
     # ./vendor/bundle/ruby/3.2.0/gems/aruba-2.1.0/lib/aruba/api/commands.rb:259:in `start_command'
     # ./vendor/bundle/ruby/3.2.0/gems/aruba-2.1.0/lib/aruba/api/commands.rb:191:in `run_command_and_stop'
     # ./spec/cli/cli_help_spec.rb:3:in `block (2 levels) in <top (required)>'
     # ./vendor/bundle/ruby/3.2.0/gems/aruba-2.1.0/lib/aruba/rspec.rb:35:in `block (3 levels) in <top (required)>'
     # ./vendor/bundle/ruby/3.2.0/gems/aruba-2.1.0/lib/aruba/platforms/local_environment.rb:22:in `call'
     # ./vendor/bundle/ruby/3.2.0/gems/aruba-2.1.0/lib/aruba/platforms/unix_platform.rb:79:in `with_environment'
     # ./vendor/bundle/ruby/3.2.0/gems/aruba-2.1.0/lib/aruba/api/core.rb:222:in `block in with_environment'
     # ./vendor/bundle/ruby/3.2.0/gems/aruba-2.1.0/lib/aruba/platforms/unix_environment_variables.rb:189:in `nest'
     # ./vendor/bundle/ruby/3.2.0/gems/aruba-2.1.0/lib/aruba/api/core.rb:220:in `with_environment'
     # ./vendor/bundle/ruby/3.2.0/gems/aruba-2.1.0/lib/aruba/rspec.rb:34:in `block (2 levels) in <top (required)>'
     # ./vendor/bundle/ruby/3.2.0/gems/aruba-2.1.0/lib/aruba/rspec.rb:25:in `block (2 levels) in <top (required)>'

✅ What did you expect to see?

The command being executed withouth error.

📦 Which tool/library version are you using?

Operating System
Microsoft Windows Server 2022
10.0.20348
Datacenter

C:\hostedtoolcache\windows\Ruby\3.2.2\x64\bin\ruby.exe --version
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x64-mingw-ucrt]

Using Bundler 2.4.13 from Gemfile.lock BUNDLED WITH 2.4.13

Using rake 13.0.6
Using bundler 2.4.13
Using childprocess 4.1.0
Using contracts 0.17
Using builder 3.2.4
Using cucumber-ci-environment 9.2.0
Using cucumber-messages 18.0.0
Using cucumber-gherkin 23.0.1
Using cucumber-tag-expressions 4.1.0
Using cucumber-core 11.0.0
Using cucumber-cucumber-expressions 15.2.0
Using cucumber-html-formatter 19.2.0
Using diff-lcs 1.5.0
Using mime-types-data 3.2023.0218.1
Using mime-types 3.4.1
Using multi_test 1.1.0
Using ffi 1.15.5
Using sys-uname 1.2.3
Using cucumber 8.0.0
Using rspec-support 3.12.0
Using rspec-expectations 3.12.3
Using thor 1.2.2
Using aruba 2.1.0
Using fiber-annotation 0.2.0
Using fiber-local 1.0.0
Using console 1.17.2
Using io-event 1.2.2
Using timers 4.3.5
Using async 2.6.2
Using async-io 1.35.0
Using colorize 0.8.1
Using regexp_parser 2.8.1
Using ecma-re-validator 0.4.0
Using hana 1.3.7
Using unf_ext 0.0.8.2
Using unf 0.1.4
Using simpleidn 0.2.1
Using uri_template 0.7.0
Using json_schemer 0.2.25
Using rsmp_schema 0.4.0
Using rsmp 0.20.2 from source at . and installing its executables
Using rspec-core 3.12.2
Using rspec-mocks 3.12.5
Using rspec 3.12.0
Using timecop 0.9.6

🔬 How could we reproduce it?

For this reproduction I'm running rspec --help, since that means the example use an executable that's already installed. In the real use-case I would of call another command. But the error is the same.

RSpec.describe 'aruba windows', :type => :aruba do
  it 'can run command and stop' do
    run_command_and_stop('rspec --help', exit_timeout: 1, fail_on_error: false)
  end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant