crystal-lang / shards

Dependency manager for the Crystal language
Other
758 stars 99 forks source link

Different behavior between `shards run` and `crystal run` #580

Closed Capital-EX closed 1 year ago

Capital-EX commented 1 year ago

While working with Crysterm, I found that shards run and crystal run handle terminal input differently. For crysterm, while using shards run, the application would run, but no keyboard input would be registered. With Crystal's 2048 example, shards run would fail with the following error code:

Error running at_exit handler: tcgetattr: Inappropriate ioctl for device
Unhandled exception: tcgetattr: Inappropriate ioctl for device (IO::Error)
  from /usr/lib/crystal/crystal/system/unix/file_descriptor.cr:229:5 in 'read_keypress'
  from src/experiments.cr:222:5 in 'read_action'
  from src/experiments.cr:198:25 in 'run'
  from src/experiments.cr:384:1 in '__crystal_main'
  from /usr/lib/crystal/crystal/main.cr:115:5 in 'main_user_code'
  from /usr/lib/crystal/crystal/main.cr:101:7 in 'main'
  from /usr/lib/crystal/crystal/main.cr:127:3 in 'main'
  from /usr/lib/libc.so.6 in '??'
  from /usr/lib/libc.so.6 in '__libc_start_main'
  from /home/exarch/Documents/projects-crystal/experiments/bin/experiments in '_start'
  from ???

I don't know why this behavior is happening. It does not happen when using crystal run

Blacksmoke16 commented 1 year ago

Possibly related: https://github.com/crystal-lang/shards/pull/561

Capital-EX commented 1 year ago

Running it under Shards 0.17.2 does the trick. Seems like this issue is already fixed then.

beta-ziliani commented 1 year ago

Closing it then.