ruby-lsapi 2.1 → 2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/ext/lsapi/lsruby.c +25 -0
  2. metadata +2 -2
data/ext/lsapi/lsruby.c CHANGED
@@ -18,6 +18,7 @@ RUBY_EXTERN VALUE rb_defout;
18
18
 
19
19
  static VALUE orig_stdin;
20
20
  static VALUE orig_stdout;
21
+ static VALUE orig_stderr;
21
22
  #if RUBY_VERSION_CODE < 180
22
23
  static VALUE orig_defout;
23
24
  #endif
@@ -501,6 +502,27 @@ static VALUE lsapi_close(VALUE self)
501
502
  }
502
503
 
503
504
 
505
+ static VALUE lsapi_reopen( int argc, VALUE *argv, VALUE self)
506
+ {
507
+ VALUE orig_verbose; // constant silence hack
508
+ if ( self == s_req_stderr )
509
+ {
510
+ //constant silence hack
511
+ orig_verbose = (VALUE)ruby_verbose;
512
+ ruby_verbose = Qnil;
513
+
514
+ rb_define_global_const("STDERR", orig_stderr);
515
+
516
+ ruby_verbose = (VALUE)orig_verbose;
517
+
518
+ return rb_io_reopen( argc, argv, orig_stderr );
519
+
520
+ }
521
+ return self;
522
+ }
523
+
524
+
525
+
504
526
  void Init_lsapi()
505
527
  {
506
528
  VALUE remove_env;
@@ -565,6 +587,7 @@ void Init_lsapi()
565
587
 
566
588
  orig_stdin = rb_stdin;
567
589
  orig_stdout = rb_stdout;
590
+ orig_stderr = rb_stderr;
568
591
  #if RUBY_VERSION_CODE < 180
569
592
  orig_defout = rb_defout;
570
593
  #endif
@@ -607,6 +630,8 @@ void Init_lsapi()
607
630
  //rb_define_method(cLSAPI, "tty?", lsapi_isatty, 0);
608
631
  rb_define_method(cLSAPI, "sync", lsapi_sync, 0);
609
632
  rb_define_method(cLSAPI, "sync=", lsapi_setsync, 1);
633
+ rb_define_method(cLSAPI, "reopen", lsapi_reopen, -1 );
634
+
610
635
 
611
636
  s_req = Data_Make_Struct( cLSAPI, lsapi_data, lsapi_mark, free, s_req_data );
612
637
  s_req_data->req = &g_req;
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
3
3
  specification_version: 1
4
4
  name: ruby-lsapi
5
5
  version: !ruby/object:Gem::Version
6
- version: "2.1"
7
- date: 2007-03-07 00:00:00 -05:00
6
+ version: "2.2"
7
+ date: 2007-03-09 00:00:00 -05:00
8
8
  summary: A ruby extension for fast communication with LiteSpeed Web Server.
9
9
  require_paths:
10
10
  - lib