winrm 2.3.0 → 2.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. checksums.yaml +4 -4
  2. data/lib/winrm/http/transport.rb +1 -1
  3. data/lib/winrm/psrp/message.rb +128 -128
  4. data/lib/winrm/shells/power_shell.rb +0 -1
  5. data/lib/winrm/version.rb +1 -1
  6. metadata +12 -85
  7. data/.gitignore +0 -10
  8. data/.rubocop.yml +0 -38
  9. data/.travis.yml +0 -10
  10. data/Gemfile +0 -2
  11. data/Rakefile +0 -33
  12. data/Vagrantfile +0 -6
  13. data/WinrmAppveyor.psm1 +0 -32
  14. data/appveyor.yml +0 -50
  15. data/changelog.md +0 -133
  16. data/preamble +0 -17
  17. data/tests/integration/auth_timeout_spec.rb +0 -17
  18. data/tests/integration/cmd_spec.rb +0 -130
  19. data/tests/integration/config-example.yml +0 -16
  20. data/tests/integration/issue_59_spec.rb +0 -25
  21. data/tests/integration/powershell_spec.rb +0 -164
  22. data/tests/integration/spec_helper.rb +0 -62
  23. data/tests/integration/transport_spec.rb +0 -98
  24. data/tests/integration/wql_spec.rb +0 -33
  25. data/tests/matchers.rb +0 -59
  26. data/tests/spec/configuration_spec.rb +0 -183
  27. data/tests/spec/connection_spec.rb +0 -37
  28. data/tests/spec/exception_spec.rb +0 -49
  29. data/tests/spec/http/transport_factory_spec.rb +0 -66
  30. data/tests/spec/http/transport_spec.rb +0 -43
  31. data/tests/spec/output_spec.rb +0 -128
  32. data/tests/spec/psrp/fragment_spec.rb +0 -60
  33. data/tests/spec/psrp/message_data/base_spec.rb +0 -11
  34. data/tests/spec/psrp/message_data/error_record_spec.rb +0 -39
  35. data/tests/spec/psrp/message_data/pipeline_host_call_spec.rb +0 -23
  36. data/tests/spec/psrp/message_data/pipeline_output_spec.rb +0 -30
  37. data/tests/spec/psrp/message_data/pipeline_state_spec.rb +0 -38
  38. data/tests/spec/psrp/message_data/runspace_pool_host_call_spec.rb +0 -23
  39. data/tests/spec/psrp/message_data/runspacepool_state_spec.rb +0 -14
  40. data/tests/spec/psrp/message_data/session_capability_spec.rb +0 -28
  41. data/tests/spec/psrp/message_data_spec.rb +0 -33
  42. data/tests/spec/psrp/message_defragmenter_spec.rb +0 -45
  43. data/tests/spec/psrp/message_fragmenter_spec.rb +0 -103
  44. data/tests/spec/psrp/powershell_output_decoder_spec.rb +0 -98
  45. data/tests/spec/psrp/psrp_message_spec.rb +0 -73
  46. data/tests/spec/psrp/recieve_response_reader_spec.rb +0 -170
  47. data/tests/spec/psrp/uuid_spec.rb +0 -28
  48. data/tests/spec/response_handler_spec.rb +0 -69
  49. data/tests/spec/shells/base_spec.rb +0 -227
  50. data/tests/spec/shells/cmd_spec.rb +0 -75
  51. data/tests/spec/shells/powershell_spec.rb +0 -221
  52. data/tests/spec/spec_helper.rb +0 -46
  53. data/tests/spec/stubs/clixml/error_record.xml.erb +0 -84
  54. data/tests/spec/stubs/clixml/pipeline_state.xml.erb +0 -88
  55. data/tests/spec/stubs/responses/get_command_output_response.xml.erb +0 -13
  56. data/tests/spec/stubs/responses/get_command_output_response_not_done.xml.erb +0 -10
  57. data/tests/spec/stubs/responses/get_omi_command_output_response.xml.erb +0 -23
  58. data/tests/spec/stubs/responses/get_omi_command_output_response_not_done.xml.erb +0 -24
  59. data/tests/spec/stubs/responses/get_omi_config_response.xml +0 -45
  60. data/tests/spec/stubs/responses/get_omi_powershell_keepalive_response.xml.erb +0 -33
  61. data/tests/spec/stubs/responses/get_powershell_keepalive_response.xml.erb +0 -10
  62. data/tests/spec/stubs/responses/get_powershell_output_response.xml.erb +0 -12
  63. data/tests/spec/stubs/responses/get_powershell_output_response_not_done.xml.erb +0 -9
  64. data/tests/spec/stubs/responses/open_shell_omi.xml +0 -43
  65. data/tests/spec/stubs/responses/open_shell_v1.xml +0 -19
  66. data/tests/spec/stubs/responses/open_shell_v2.xml +0 -20
  67. data/tests/spec/stubs/responses/soap_fault_omi.xml +0 -31
  68. data/tests/spec/stubs/responses/soap_fault_v1.xml +0 -36
  69. data/tests/spec/stubs/responses/soap_fault_v2.xml +0 -42
  70. data/tests/spec/stubs/responses/wmi_error_v2.xml +0 -41
  71. data/tests/spec/wsmv/cleanup_command_spec.rb +0 -20
  72. data/tests/spec/wsmv/close_shell_spec.rb +0 -15
  73. data/tests/spec/wsmv/command_output_decoder_spec.rb +0 -35
  74. data/tests/spec/wsmv/command_output_spec.rb +0 -43
  75. data/tests/spec/wsmv/command_spec.rb +0 -17
  76. data/tests/spec/wsmv/configuration_spec.rb +0 -15
  77. data/tests/spec/wsmv/create_pipeline_spec.rb +0 -30
  78. data/tests/spec/wsmv/create_shell_spec.rb +0 -39
  79. data/tests/spec/wsmv/init_runspace_pool_spec.rb +0 -38
  80. data/tests/spec/wsmv/keep_alive_spec.rb +0 -21
  81. data/tests/spec/wsmv/receive_response_reader_spec.rb +0 -124
  82. data/tests/spec/wsmv/send_data_spec.rb +0 -30
  83. data/tests/spec/wsmv/wql_query_spec.rb +0 -11
  84. data/tests/spec/wsmv/write_stdin_spec.rb +0 -20
  85. data/winrm.gemspec +0 -46
@@ -1,38 +0,0 @@
1
- AllCops:
2
- Exclude:
3
- - 'appveyor.yml'
4
- - 'Vagrantfile'
5
- - 'scripts/**/*'
6
-
7
- Style/Encoding:
8
- Enabled: true
9
-
10
- Style/NumericLiterals:
11
- Enabled: false
12
-
13
- Layout/EndOfLine:
14
- Enabled: false
15
-
16
- Layout/IndentHeredoc:
17
- Enabled: false
18
-
19
- Metrics/BlockLength:
20
- Max: 200
21
-
22
- Metrics/LineLength:
23
- Max: 120
24
-
25
- Metrics/MethodLength:
26
- Max: 20
27
-
28
- ModuleLength:
29
- Max: 250
30
-
31
- Naming/HeredocDelimiterNaming:
32
- Enabled: false
33
-
34
- ClassLength:
35
- Max: 250
36
-
37
- Metrics/AbcSize:
38
- Max: 25
@@ -1,10 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.2.0
4
- before_install:
5
- - gem update bundler
6
-
7
- # This prevents testing branches that are created just for PRs
8
- branches:
9
- only:
10
- - master
data/Gemfile DELETED
@@ -1,2 +0,0 @@
1
- source 'https://rubygems.org'
2
- gemspec
data/Rakefile DELETED
@@ -1,33 +0,0 @@
1
- require 'rubygems'
2
- require 'bundler/setup'
3
- require 'rspec/core/rake_task'
4
- require 'rubocop/rake_task'
5
- require 'bundler/gem_tasks'
6
-
7
- # Change to the directory of this file.
8
- Dir.chdir(File.expand_path(__dir__))
9
-
10
- desc 'Open a Pry console for this library'
11
- task :console do
12
- require 'pry'
13
- require 'winrm'
14
- ARGV.clear
15
- Pry.start
16
- end
17
-
18
- RSpec::Core::RakeTask.new(:spec) do |task|
19
- task.pattern = 'tests/spec/**/*_spec.rb'
20
- task.rspec_opts = ['--color', '-f documentation', '-r ./tests/spec/spec_helper']
21
- end
22
-
23
- # Run the integration test suite
24
- RSpec::Core::RakeTask.new(:integration) do |task|
25
- task.pattern = 'tests/integration/*_spec.rb'
26
- task.rspec_opts = ['--color', '-f documentation', '-r ./tests/integration/spec_helper']
27
- end
28
-
29
- RuboCop::RakeTask.new
30
-
31
- task default: %i[spec rubocop]
32
-
33
- task all: %i[default integration]
@@ -1,6 +0,0 @@
1
- # -*- mode: ruby -*-
2
- # vi: set ft=ruby :
3
-
4
- Vagrant.configure("2") do |config|
5
- config.vm.box = "mwrock/WindowsNano"
6
- end
@@ -1,32 +0,0 @@
1
- function New-ClientCertificate {
2
- param([String]$username, [String]$basePath = ((Resolve-Path .).Path))
3
-
4
- $env:OPENSSL_CONF=[System.IO.Path]::GetTempFileName()
5
-
6
- Set-Content -Path $env:OPENSSL_CONF -Value @"
7
- distinguished_name = req_distinguished_name
8
- [req_distinguished_name]
9
- [v3_req_client]
10
- extendedKeyUsage = clientAuth
11
- subjectAltName = otherName:1.3.6.1.4.1.311.20.2.3;UTF8:$username@localhost
12
- "@
13
-
14
- $user_path = Join-Path $basePath user.pem
15
- $key_path = Join-Path $basePath key.pem
16
- $pfx_path = Join-Path $basePath user.pfx
17
-
18
- openssl req -x509 -nodes -days 3650 -newkey rsa:2048 -out $user_path -outform PEM -keyout $key_path -subj "/CN=$username" -extensions v3_req_client 2>&1
19
-
20
- openssl pkcs12 -export -in $user_path -inkey $key_path -out $pfx_path -passout pass: 2>&1
21
-
22
- del $env:OPENSSL_CONF
23
- }
24
-
25
- function New-WinrmUserCertificateMapping {
26
- param([String]$issuer)
27
- $secure_pass = ConvertTo-SecureString $env:winrm_password -AsPlainText -Force
28
- $cred = New-Object System.Management.Automation.PSCredential ($env:winrm_user, $secure_pass)
29
- New-Item -Path WSMan:\localhost\ClientCertificate -Subject "$env:winrm_user@localhost" -URI * -Issuer $issuer -Credential $cred -Force
30
- }
31
-
32
- Export-ModuleMember New-ClientCertificate, New-WinrmUserCertificateMapping
@@ -1,50 +0,0 @@
1
- version: "master-{build}"
2
-
3
- os: Windows Server 2012 R2
4
- platform:
5
- - x64
6
-
7
- environment:
8
- winrm_user: test_user
9
- winrm_password: Pass@word1
10
- user_cert: c:\projects\winrm\user.pem
11
- user_key: c:\projects\winrm\key.pem
12
-
13
- matrix:
14
- - ruby_version: "22"
15
- winrm_endpoint: http://localhost:5985/wsman
16
-
17
- clone_folder: c:\projects\winrm
18
- clone_depth: 1
19
- branches:
20
- only:
21
- - master
22
-
23
- install:
24
- - ps: net user /add $env:winrm_user $env:winrm_password
25
- - ps: net localgroup administrators $env:winrm_user /add
26
- - ps: $env:PATH="C:\OpenSSL-Win64\bin;$env:PATH"
27
- - ps: Import-Module c:\projects\winrm\WinrmAppveyor.psm1
28
- - ps: New-ClientCertificate $env:winrm_user c:\projects\winrm
29
- - ps: $env:user_cert_thumb = (Import-pfxCertificate -FilePath c:\projects\winrm\user.pfx -CertStoreLocation Cert:\LocalMachine\root).Thumbprint
30
- - ps: Import-pfxCertificate -FilePath c:\projects\winrm\user.pfx -CertStoreLocation Cert:\LocalMachine\TrustedPeople
31
- - ps: $env:winrm_cert = (New-SelfSignedCertificate -DnsName localhost -CertStoreLocation cert:\localmachine\my).Thumbprint
32
- - ps: winrm create winrm/config/Listener?Address=*+Transport=HTTPS "@{Hostname=`"localhost`";CertificateThumbprint=`"$($env:winrm_cert)`"}"
33
- - ps: winrm set winrm/config/client/auth '@{Basic="true"}'
34
- - ps: winrm set winrm/config/service/auth '@{Basic="true"}'
35
- - ps: winrm set winrm/config/service/auth '@{Certificate="true"}'
36
- - ps: winrm set winrm/config/service/auth '@{CbtHardeningLevel="Strict"}'
37
- - ps: winrm set winrm/config/service '@{AllowUnencrypted="true"}'
38
- - ps: New-WinrmUserCertificateMapping $env:user_cert_thumb
39
- - ps: $env:PATH="C:\Ruby$env:ruby_version\bin;$env:PATH"
40
- - ps: Write-Host $env:PATH
41
- - ps: ruby --version
42
- - ps: gem --version
43
- - ps: bundler --version
44
-
45
- build_script:
46
- - bundle install || bundle install || bundle install
47
-
48
- test_script:
49
- - SET SPEC_OPTS=--format progress
50
- - bundle exec rake integration
@@ -1,133 +0,0 @@
1
- # WinRM Gem Changelog
2
-
3
- # 2.3.0
4
- - Fixes rwinrm command
5
- - Use pack('S*') instead of .chr so full utf-16 can be supported
6
- - Omi Server compatibility fixes
7
-
8
- # 2.2.3
9
- - Revert change made in 2.2.2 that retries network errors in Close and cleanup
10
-
11
- # 2.2.2
12
- - Update PSRP buffer size
13
- - Close and cleanup should retry on error and never raise net errors
14
-
15
- # 2.2.1
16
- - Ignore error 2150858843 during shell closing
17
-
18
- # 2.2.0
19
- - Allow run_wql to accept custom namespace
20
- - Allow enumeration of WQL result sets
21
-
22
- # 2.1.3
23
- - Ignore WSManFault 2150858843 during command cleanup
24
- - Uns `Integer` in place of `Fixnum` to remove deprecation warnings in ruby 2.4
25
-
26
- # 2.1.2
27
- - Fix kerberos transport
28
-
29
- # 2.1.1
30
- - Fix rendering of powershell output with non ascii UTF-8 characters emitted from executables
31
-
32
- # 2.1.0
33
- - Expose shell options when creating a winrm shell
34
-
35
- # 2.0.3
36
- - Do not swallow exit codes from executables
37
-
38
- # 2.0.2
39
- - Constrain to rubyntlm `>= 0.6.1` to avoid mutating frozen strings
40
- - When using certificate authentication, do not validate presense of user and password
41
- - Handle failed `PIPELINE_STATE` messages so that `throw` errors are not swallowed
42
-
43
- # 2.0.1
44
- - Fixed Powershell shell leakage when not explicitly closed
45
- - Fixed cmd commands with responses that extend beyond one stream
46
-
47
- # 2.0.0
48
- - Cleaned up API and implemented Powershell Remoting Protocol (PSRP) for all powershell calls.
49
-
50
- # 1.8.1
51
- - Http receive timeout should always be equal to 10 seconds greater than the winrm operation timeout and not default to one hour
52
-
53
- # 1.8.0
54
- - Add certificate authentication
55
-
56
- # 1.7.3
57
- - Open a new shell if the current shell has been deleted
58
-
59
- # 1.7.2
60
- - Fix regression where BOM appears in 2008R2 output and is not stripped
61
-
62
- # 1.7.1
63
- - Fix OS version comparisons for Windows 10 using `Gem::Version` instead of strings
64
-
65
- # 1.7.0
66
- - Bump rubyntlm gem to 0.6.0 to get channel binding support for HTTPS fixing connections to endoints with `CbtHardeningLevel` set to `Strict`
67
- - Fix for parsing binary data in command output
68
-
69
- # 1.6.1
70
- - Use codepage 437 by default on os versions older than Windows 7 and Windows Server 2008 R2
71
-
72
- # 1.6.0
73
- - Adding `:negotiate` transport providing NTLM/Negotiate encryption of WinRM requests and responses
74
- - Removed dependency on UUIDTools gem
75
- - Extending accepted error codes for retry behavior to include `Errno::ETIMEDOUT`
76
- - Correct deprecation warning for WinRMWebService.run_powershell_script
77
-
78
- # 1.5.0
79
- - Deprecating `WinRM::WinRMWebService` methods `cmd`, `run_cmd`, `powershell`, and `run_powershell_script` in favor of the `run_cmd` and `run_powershell_script` methods of the `WinRM::CommandExecutor` class. The `CommandExecutor` allows multiple commands to be run from the same WinRM shell providing a significant performance improvement when issuing multiple calls.
80
- - Added an `:ssl_peer_fingerprint` option to be used instead of `:no_ssl_peer_verification` and allows a specific certificate to be verified.
81
- - Opening a winrm shell is retriable with configurable delay and retry limit.
82
- - Logging apends to `stdout` by default and can be replaced with a logger from a consuming application.
83
-
84
- # 1.4.0
85
- - Added WinRM::Version so the gem version is available at runtime for consumers.
86
-
87
- # 1.3.6
88
- - Remove BOM from response (Issue #159) added by Windows 2008R2
89
-
90
- # 1.3.5
91
- - Widen logging version constraints to include 2.0
92
- - Use codepage 65001 (UTF-8)
93
-
94
- # 1.3.4
95
- - Relaxed version pins on dev dependencies
96
-
97
- # 1.3.3
98
- - Fixed issue 133, rwinrm allow hostnames with dashes
99
- - Use duck typing for powershell script read
100
-
101
- # 1.3.2
102
- - Add spec.license attribute to gemspec
103
- - Bump RSpec dependency 3.0 to 3.2
104
-
105
- # 1.3.1
106
- - Fixed issue 129, long running commands could cause a stackoverflow exception
107
- - Fixed use of sub! in run_command results in spurious capture/replacement of \& sequences
108
- - Fixed issue 124 rwinrm won't take '.' characters in username
109
-
110
- # 1.3.0
111
- - Fixed multiple issues with WinRMHTTPTransportError incorrectly being raised
112
- - Refactored and added more unit and integration tests
113
- - Added ability to write to stdin
114
- - Added rwinrm binary to launch remote shell
115
- - Added WINRM_LOG env var to set log level
116
- - Retry Kerberos auth once if 401 response is received
117
- - Remove Savon dependency and use newer versions of underlying dependencies
118
- - Remove Nokogiri dependency and replace with native Ruby XML
119
- - Fixed issue 85, ensure WQL response is not nil
120
- - All WinRM library errors inherit from base class WinRMError
121
- - Integrations tests should now pass on Windows Server 2008+
122
- - Bump Ruby NTLM gem version dependency
123
- - HTTP client receive timeout is now configurable via set_timeout
124
- - Added backwards compatible Output class to make it easier to collect output
125
- - Bumped gssapi dependency from 1.0 to 1.2 and fixed issue 54
126
- - Added Rubocop to build
127
- - Fixed error when commands contain a newline character
128
-
129
- # 1.2.0
130
- - Allow user to disable SSL peer ceritifcate validation #44
131
- - Allow commands with "'" chars on Ruby 2.x, fixes #69
132
- - Fixed uninitialized constant Module::Kconv in Ruby 2.x, fixes #65
133
- - Commands with non-ASCII chars should work, #70
data/preamble DELETED
@@ -1,17 +0,0 @@
1
- =begin
2
- This file is part of WinRM; the Ruby library for Microsoft WinRM.
3
-
4
- Copyright © 2010 Dan Wanek <dan.wanek@gmail.com>
5
-
6
- Licensed under the Apache License, Version 2.0 (the "License");
7
- you may not use this file except in compliance with the License.
8
- You may obtain a copy of the License at
9
-
10
- http://www.apache.org/licenses/LICENSE-2.0
11
-
12
- Unless required by applicable law or agreed to in writing, software
13
- distributed under the License is distributed on an "AS IS" BASIS,
14
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- See the License for the specific language governing permissions and
16
- limitations under the License.
17
- =end
@@ -1,17 +0,0 @@
1
- require_relative 'spec_helper'
2
-
3
- # This test may only be meaningful with kerberos auth
4
- # Against server 2012, a kerberos connection will require reauth (get a 401)
5
- # if there are no requests for >= 15 seconds
6
-
7
- describe 'Verify kerberos will reauth when necessary', kerberos: true do
8
- before(:all) do
9
- @powershell = winrm_connection.shell(:powershell)
10
- end
11
-
12
- it 'work with a 18 second sleep' do
13
- ps_command = 'Start-Sleep -s 18'
14
- output = @powershell.run(ps_command)
15
- expect(output.exitcode).to eq(0)
16
- end
17
- end
@@ -1,130 +0,0 @@
1
- require_relative 'spec_helper'
2
-
3
- describe 'winrm client cmd' do
4
- before(:all) do
5
- @cmd_shell = winrm_connection.shell(:cmd)
6
- end
7
-
8
- describe 'empty string' do
9
- subject(:output) { @cmd_shell.run('') }
10
- it { should have_exit_code 0 }
11
- it { should have_no_stdout }
12
- it { should have_no_stderr }
13
- end
14
-
15
- describe 'ipconfig' do
16
- subject(:output) { @cmd_shell.run('ipconfig') }
17
- it { should have_exit_code 0 }
18
- it { should have_stdout_match(/Windows IP Configuration/) }
19
- it { should have_no_stderr }
20
- end
21
-
22
- describe 'codepage' do
23
- let(:options) { {} }
24
- let(:shell) { winrm_connection.shell(:cmd, options) }
25
-
26
- after { shell.close }
27
-
28
- subject(:output) { shell.run('chcp') }
29
-
30
- it 'should default to UTF-8 (65001)' do
31
- should have_stdout_match(/Active code page: 65001/)
32
- end
33
-
34
- context 'when changing the codepage' do
35
- let(:options) { { codepage: 437 } }
36
-
37
- it 'sets the codepage to the one given' do
38
- should have_stdout_match(/Active code page: 437/)
39
- end
40
- end
41
- end
42
-
43
- describe 'echo \'hello world\' using apostrophes' do
44
- subject(:output) { @cmd_shell.run("echo 'hello world'") }
45
- it { should have_exit_code 0 }
46
- it { should have_stdout_match(/'hello world'/) }
47
- it { should have_no_stderr }
48
- end
49
-
50
- describe 'multi stream output from large file' do
51
- subject(:output) { @cmd_shell.run('type c:\windows\logs\dism\dism.log') }
52
- it { should have_exit_code 0 }
53
- it { should have_no_stderr }
54
- end
55
-
56
- describe 'echo "string with trailing \\" using double quotes' do
57
- # This is a regression test for #131. " is converted to &quot; when serializing
58
- # the command to SOAP/XML. Any naive substitution performed on such a serialized
59
- # string can result in any \& sequence being interpreted as a back-substitution.
60
- subject(:output) { @cmd_shell.run('echo "string with trailing \\"') }
61
- it { should have_exit_code 0 }
62
- it { should have_stdout_match(/string with trailing \\/) }
63
- it { should have_no_stderr }
64
- end
65
-
66
- describe 'capturing output from stdout and stderr' do
67
- subject(:output) do
68
- # Note: Multiple lines doesn't work:
69
- # script = <<-eos
70
- # echo Hello
71
- # echo , world! 1>&2
72
- # eos
73
-
74
- script = 'echo Hello & echo , world! 1>&2'
75
-
76
- @captured_stdout = ''
77
- @captured_stderr = ''
78
- @cmd_shell.run(script) do |stdout, stderr|
79
- @captured_stdout << stdout if stdout
80
- @captured_stderr << stderr if stderr
81
- end
82
- end
83
-
84
- it 'should have stdout' do
85
- expect(output.stdout).to eq("Hello \r\n")
86
- expect(output.stdout).to eq(@captured_stdout)
87
- end
88
-
89
- it 'should have stderr' do
90
- expect(output.stderr).to eq(", world! \r\n")
91
- expect(output.stderr).to eq(@captured_stderr)
92
- end
93
-
94
- it 'should have output' do
95
- expect(output.output).to eq("Hello \r\n, world! \r\n")
96
- end
97
- end
98
-
99
- describe 'ipconfig with /all argument' do
100
- subject(:output) { @cmd_shell.run('ipconfig', %w[/all]) }
101
- it { should have_exit_code 0 }
102
- it { should have_stdout_match(/Windows IP Configuration/) }
103
- it { should have_no_stderr }
104
- end
105
-
106
- describe 'dir with incorrect argument /z' do
107
- subject(:output) { @cmd_shell.run('dir /z') }
108
- it { should have_exit_code 1 }
109
- it { should have_no_stdout }
110
- it { should have_stderr_match(/Invalid switch/) }
111
- end
112
-
113
- describe 'ipconfig && echo error 1>&2' do
114
- subject(:output) { @cmd_shell.run('ipconfig && echo error 1>&2') }
115
- it { should have_exit_code 0 }
116
- it { should have_stdout_match(/Windows IP Configuration/) }
117
- it { should have_stderr_match(/error/) }
118
- end
119
-
120
- describe 'ipconfig with a block' do
121
- subject(:stdout) do
122
- outvar = ''
123
- @cmd_shell.run('ipconfig') do |stdout, _stderr|
124
- outvar << stdout
125
- end
126
- outvar
127
- end
128
- it { should match(/Windows IP Configuration/) }
129
- end
130
- end