soutaro / steep

Static type checker for Ruby
MIT License
1.37k stars 84 forks source link

Cannot run `steep check` against Windows environment #383

Closed JunichiIto closed 2 years ago

JunichiIto commented 3 years ago

I'm trying to run steep against Windows environment. I installed Ruby 3.0.1 with RubyInstaller, then installed rbs 1.2.0 and steep 0.44.1.

C:\Users\JunichiIto\ruby-book-v2>ruby -v
ruby 3.0.1p64 (2021-04-05 revision 0fb782ee38) [x64-mingw32]

C:\Users\JunichiIto\ruby-book-v2>rbs --version
rbs 1.2.0

C:\Users\JunichiIto\ruby-book-v2>steep --version
0.44.1

Here are my scripts for testing purpose:

# lib/fizz_buzz.rb
def fizz_buzz(n)
  if n % 15 == 0
    'Fizz Buzz'
  elsif n % 3 == 0
    'Fizz'
  elsif n % 5 == 0
    'Buzz'
  else
    n.to_s
  end
end

# test/fizz_buzz_test.rb
require 'minitest/autorun'
require_relative '../lib/fizz_buzz'

class FizzBuzzTest < Minitest::Test
  def test_fizz_buzz
    assert_equal '1', fizz_buzz(1)
    assert_equal '2', fizz_buzz(2)
    assert_equal 'Fizz', fizz_buzz(3)
    assert_equal '4', fizz_buzz(4)
    assert_equal 'Buzz', fizz_buzz(5)
    assert_equal 'Fizz', fizz_buzz(6)
    assert_equal 'Fizz Buzz', fizz_buzz(15)
  end
end

# sig/fizz_buzz.rbs
class Object
  private
  def fizz_buzz: (Integer n) -> String
end

class FizzBuzzTest
  def test_fizz_buzz: -> untyped
end

# Steepfile
target :lib do
  check 'lib/fizz_buzz.rb'
  check 'test/fizz_buzz_test.rb'
  signature 'sig'
end

I ran steep check but I got this error:

C:\Users\JunichiIto\ruby-book-v2>steep check
# Type checking files:

#<ArgumentError: wrong exec option symbol: pgroup>
  C:/Ruby30-x64/lib/ruby/3.0.0/open3.rb:221:in `spawn'
  C:/Ruby30-x64/lib/ruby/3.0.0/open3.rb:221:in `popen_run'
  C:/Ruby30-x64/lib/ruby/3.0.0/open3.rb:160:in `popen2'
  C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/steep-0.44.1/lib/steep/server/worker_process.rb:36:in `spawn_worker'
  C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/steep-0.44.1/lib/steep/server/worker_process.rb:47:in `block in spawn_typecheck_workers'
  C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/steep-0.44.1/lib/steep/server/worker_process.rb:46:in `times'
  C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/steep-0.44.1/lib/steep/server/worker_process.rb:46:in `each'
  C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/steep-0.44.1/lib/steep/server/worker_process.rb:46:in `map'
  C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/steep-0.44.1/lib/steep/server/worker_process.rb:46:in `spawn_typecheck_workers'
  C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/steep-0.44.1/lib/steep/drivers/check.rb:36:in `run'
  C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/steep-0.44.1/lib/steep/cli.rb:107:in `process_check'
  C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/steep-0.44.1/lib/steep/cli.rb:52:in `run'
  C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/steep-0.44.1/exe/steep:11:in `<top (required)>'
  C:/Ruby30-x64/bin/steep:23:in `load'
  C:/Ruby30-x64/bin/steep:23:in `<main>'

I searched Google and found this PR, so I changed this line:

-stdin, stdout, thread = Open3.popen2(*command, pgroup: true)
+stdin, stdout, thread = Open3.popen2(*command, new_pgroup: true)

I tried again, but steep seemed to be freezed:

C:\Users\JunichiIto\ruby-book-v2>steep check
# Type checking files:

I sent Ctrl-C, then got this information:

C:\Users\JunichiIto\ruby-book-v2>steep check
# Type checking files:

C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/language_server-protocol-3.16.0.1/lib/language_server/protocol/transport/io/reader.rb:17:in `getc': Interrupt
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/language_server-protocol-3.16.0.1/lib/language_server/protocol/transport/io/reader.rb:17:in `read'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/steep-0.44.1/lib/steep/drivers/utils/driver_helper.rb:43:in `wait_for_message'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/steep-0.44.1/lib/steep/drivers/utils/driver_helper.rb:29:in `wait_for_response_id'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/steep-0.44.1/lib/steep/drivers/check.rb:61:in `run'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/steep-0.44.1/lib/steep/cli.rb:107:in `process_check'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/steep-0.44.1/lib/steep/cli.rb:52:in `run'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/steep-0.44.1/exe/steep:11:in `<top (required)>'
        from C:/Ruby30-x64/bin/steep:23:in `load'
        from C:/Ruby30-x64/bin/steep:23:in `<main>'
C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/steep-0.44.1/lib/steep/server/base_worker.rb:88:in `join'C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/steep-0.44.1/lib/steep/server/base_worker.rb:88:in `join': : No live threads left. Deadlock?No live threads left. Deadlock? ( (fatalfatal))

2 threads, 2 sleeps current:0x0000015e0c896140 main thread:0x0000015e0c8961402 threads, 2 sleeps current:0x000001e7d1096140 main thread:0x000001e7d1096140バッチ ジョブを終了しますか (Y/N)?

* #<Thread:0x0000015e0e504430 sleep_forever>* #<Thread:0x000001e7d2b94428 sleep_forever>

   rb_thread_t:0x000001e7d1096140 native:0x0000000000000160 int:0   rb_thread_t:0x0000015e0c896140 native:0x0000000000000160 int:0

* #<Thread:0x0000015e16493f48 C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/steep-0.44.1/lib/steep/server/base_worker.rb:41 sleep_forever>* #<Thread:0x000001e7daa70080 C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/steep-0.44.1/lib/steep/server/base_worker.rb:41 sleep_forever>

   rb_thread_t:0x000001e7d87e4130 native:0x0000000000000254 int:0   rb_thread_t:0x0000015e143621f0 native:0x00000000000001b8 int:0

    depended by: tb_thread_id:0x000001e7d1096140    depended by: tb_thread_id:0x0000015e0c896140

        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/steep-0.44.1/lib/steep/server/base_worker.rb:88:in `block in run'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/steep-0.44.1/lib/steep/server/base_worker.rb:88:in `block in run'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/activesupport-6.1.3.2/lib/active_support/tagged_logging.rb:99:in `block in tagged'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/activesupport-6.1.3.2/lib/active_support/tagged_logging.rb:99:in `block in tagged'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/activesupport-6.1.3.2/lib/active_support/tagged_logging.rb:37:in `tagged'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/activesupport-6.1.3.2/lib/active_support/tagged_logging.rb:37:in `tagged'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/activesupport-6.1.3.2/lib/active_support/tagged_logging.rb:99:in `tagged'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/activesupport-6.1.3.2/lib/active_support/tagged_logging.rb:99:in `tagged'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/steep-0.44.1/lib/steep/server/base_worker.rb:72:in `run'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/steep-0.44.1/lib/steep/server/base_worker.rb:72:in `run'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/steep-0.44.1/lib/steep/drivers/worker.rb:50:in `block in run'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/steep-0.44.1/lib/steep/drivers/worker.rb:50:in `block in run'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/activesupport-6.1.3.2/lib/active_support/tagged_logging.rb:99:in `block in tagged'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/activesupport-6.1.3.2/lib/active_support/tagged_logging.rb:99:in `block in tagged'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/activesupport-6.1.3.2/lib/active_support/tagged_logging.rb:37:in `tagged'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/activesupport-6.1.3.2/lib/active_support/tagged_logging.rb:37:in `tagged'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/activesupport-6.1.3.2/lib/active_support/tagged_logging.rb:99:in `tagged'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/activesupport-6.1.3.2/lib/active_support/tagged_logging.rb:99:in `tagged'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/steep-0.44.1/lib/steep/drivers/worker.rb:24:in `run'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/steep-0.44.1/lib/steep/drivers/worker.rb:24:in `run'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/steep-0.44.1/lib/steep/cli.rb:213:in `process_worker'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/steep-0.44.1/lib/steep/cli.rb:213:in `process_worker'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/steep-0.44.1/lib/steep/cli.rb:52:in `run'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/steep-0.44.1/lib/steep/cli.rb:52:in `run'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/steep-0.44.1/exe/steep:11:in `<top (required)>'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/steep-0.44.1/exe/steep:11:in `<top (required)>'
        from C:/Ruby30-x64/bin/steep:23:in `load'
        from C:/Ruby30-x64/bin/steep:23:in `load'
        from C:/Ruby30-x64/bin/steep:23:in `<main>'
        from C:/Ruby30-x64/bin/steep:23:in `<main>'

^C

I gave up at this point. I'm wondering if Steep works against Windows environments. Please let me know about it.

soutaro commented 3 years ago

バッチ ジョブを終了しますか (Y/N)?

🤦

JunichiIto commented 3 years ago

Thank you for your response. I understand the situation.