The Crystal Programming Language Forum

Unhandled exception: Error writing file: Broken pipe (Errno)

hello, everyone~ my code file demo.cr . is:

i = 1
while i < 100000
	puts i
	i +=1
end

after build, then run

$ ./demo |head

will got error:

1
2
3
4
5
6
7
8
9
10
Unhandled exception: Error writing file: Broken pipe (Errno)
  from /usr/share/crystal/src/crystal/system/unix/file_descriptor.cr:82:13 in 'unbuffered_write'
  from /usr/share/crystal/src/io/buffered.cr:192:5 in 'flush'
  from /usr/share/crystal/src/io/buffered.cr:144:7 in 'write'
  from /usr/share/crystal/src/io.cr:481:7 in 'write_utf8'
  from /usr/share/crystal/src/int.cr:478:7 in 'to_s'
  from /usr/share/crystal/src/int.cr:445:5 in 'to_s'
  from /usr/share/crystal/src/io.cr:184:5 in '<<'
  from /usr/share/crystal/src/io.cr:241:5 in 'puts'
  from /usr/share/crystal/src/kernel.cr:366:3 in 'puts'
  from puts.cr:3:2 in '__crystal_main'
  from /usr/share/crystal/src/crystal/main.cr:97:5 in 'main_user_code'
  from /usr/share/crystal/src/crystal/main.cr:86:7 in 'main'
  from /usr/share/crystal/src/crystal/main.cr:106:3 in 'main'
  from __libc_start_main
  from ???
  from ???
Failed to raise an exception: END_OF_STACK
[0x455406] *CallStack::print_backtrace:Int32 +118
[0x43a886] __crystal_raise +86
[0x49bc00] *IO::FileDescriptor +256
[0x49ba53] *IO::FileDescriptor +83
[0x4a81ec] *Crystal::main<Int32, Pointer(Pointer(UInt8))>:Int32 +156
[0x445296] main +6
[0x7f2856853505] __libc_start_main +245
[0x439769] ???
[0x0] ???

thanks~

Si
Regards

1 Like

This issue is tracked in https://github.com/crystal-lang/crystal/issues/7810

sorry, I missed the issue~