Process test
  • 0
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
  • 162
  • 163
  • 164
  • 165
  • 166
  • 167
  • 168
  • 169
  • 170
  • 171
  • 172
  • 173
  • 174
  • 175
  • 176
  • 177
  • 178
  • 179
  • 180
  • 181
  • 182
  • 183
  • 184
  • 185
  • 186
  • 187
  • 188
  • 189
  • 190
  • 191
  • 192
  • 193
  • 194
  • 195
  • 196
  • 197
  • 198
  • 199
  • 200
  • 201
  • 202
  • 203
  • 204
  • 205
  • 206
  • 207
  • 208
  • 209
  • 210
  • 211
  • 212
  • 213
  • 214
  • 215
  • 216
  • 217
  • 218
  • 219
  • 220
  • 221
  • 222
  • 223
  • 224
  • 225
  • 226
  • 227
  • 228
  • 229
  • 230
  • 231
  • 232
  • 233
  • 234
  • 235
  • 236
  • 237
  • 238
  • 239
  • 240
  • 241
  • 242
  • 243
  • 244
  • 245
  • 246
  • 247
  • 248
  • 249
  • 250
  • 251
  • 252
  • 253
  • 254
  • 255
  • 256
  • 257
  • 258
  • 259
  • 260
  • 261
  • 262
  • 263
  • 264
  • 265
  • 266
  • 267
  • 268
  • 269
  • 270
  • 271
  • 272
  • 273
  • 274
  • 275
  • 276
  • 277
  • 278
  • 279
  • 280
  • 281
  • 282
  • 283
  • 284
  • 285
  • 286
  • 287
  • 288
  • 289
  • 290
  • 291
  • 292
  • 293
  • 294
  • 295
  • 296
  • 297
  • 298
  • 299
  • 300
  • 301
  • 302
  • 303
  • 304
  • 305
  • 306
  • 307
  • 308
  • 309
  • 310
  • 311
  • 312
  • 313
  • 314
  • 315
  • 316
  • 317
  • 318
  • 319
  • 320
  • 321
  • 322
  • 323
  • 324
  • 325
  • 326
  • 327
  • 328
  • 329
  • 330
  • 331
  • 332
  • 333
  • 334
  • 335
  • 336
  • 337
  • 338
  • 339
  • 340
  • 341
  • 342
  • 343
  • 344
  • 345
  • 346
  • 347
  • 348
  • 349
  • 350
  • 351
  • 352
  • 353
  • 354
  • 355
  • 356
  • 357
  • 358
  • 359
  • 360
  • 361
  • 362
  • 363
  • 364
  • 365
  • 366
  • 367
  • 368
  • 369
  • 370
  • 371
  • 372
  • 373
  • 374
  • 375
  • 376
  • 377
  • 378
  • 379
  • 380
  • 381
  • 382
  • 383
  • 384
  • 385
  • 386
  • 387
  • 388
  • 389
  • 390
  • 391
  • 392
  • 393
  • 394
  • 395
  • 396
  • 397
  • 398
  • 399
  • 400
  • 401
  • 402
  • 403
  • 404
  • 405
  • 406
  • 407
  • 408
  • 409
  • 410
  • 411
  • 412
  • 413
  • 414
  • 415
  • 416
  • 417
  • 418
  • 419
  • 420
  • 421
  • 422
  • 423
  • 424
  • 425
  • 426
  • 427
  • 428
  • 429
  • 430
  • 431
  • 432
  • 433
  • 434
  • 435
  • 436
  • 437
  • 438
  • 439
  • 440
  • 441
  • 442
  • 443
  • 444
  • 445
  • 446
  • 447
  • 448
  • 449
  • 450
  • 451
  • 452
  • 453
  • 454
  • 455
  • 456
  • 457
  • 458
  • 459
  • 460
  • 461
  • 462
  • 463
  • 464
  • 465
  • 466
  • 467
  • 468
  • 469
  • 470
  • 471
  • 472
  • 473
  • 474
  • 475
  • 476
  • 477
  • 478
  • 479
  • 480
  • 481
  • 482
  • 483
  • 484
  • 485
  • 486
  • 487
  • 488
  • 489
  • 490
  • 491
  • 492
  • 493
  • 494
  • 495
  • 496
  • 497
  • 498
  • 499
  • 500
  • 501
  • 502
  • 503
  • 504
  • 505
  • 506
  • 507
  • 508
  • 509
  • 510
  • 511
  • 512
  • 513
  • 514
  • 515
  • 516
  • 517
  • 518
  • 519
  • 520
  • 521
  • 522
  • 523
  • 524
  • 525
  • 526
  • 527
  • 528
  • 529
  • 530
  • 531
  • 532
  • 533
  • 534
  • 535
  • 536
  • 537
  • 538
  • 539
  • 540
  • 541
  • 542
  • 543
  • 544
  • 545
  • 546
  • 547
  • 548
  • 549
  • 550
  • 551
  • 552
  • 553
  • 554
  • 555
  • 556
  • 557
  • 558
  • 559
  • 560
  • 561
  • 562
  • 563
  • 564
  • 565
  • 566
  • 567
  • 568
  • 569
  • 570
  • 571
  • 572
  • 573
  • 574
  • 575
  • 576
  • 577
  • 578
  • 579
  • 580
  • 581
  • 582
  • 583
  • 584
  • 585
  • 586
  • 587
  • 588
  • 589
  • 590
  • 591
  • 592
  • 593
  • 594
  • 595
  • 596
  • 597
  • 598
  • 599
  • 600
  • 601
  • 602
  • 603
  • 604
  • 605
  • 606
  • 607
  • 608
  • 609
  • 610
  • 611
  • 612
  • 613
  • 614
  • 615
  • 616
  • 617
  • 618
  • 619
  • 620
  • 621
  • 622
  • 623
  • 624
  • 625
  • 626
  • 627
  • 628
  • 629
  • 630
  • 631
  • 632
  • 633
  • 634
  • 635
  • 636
  • 637
  • 638
  • 639
  • 640
  • 641
  • 642
  • 643
  • 644
  • 645
  • 646
  • 647
  • 648
  • 649
  • 650
  • 651
  • 652
  • 653
  • 654
  • 655
  • 656
  • 657
  • 658
  • 659
  • 660
  • 661
  • 662
  • 663
  • 664
  • 665
  • 666
  • 667
  • 668
  • 669
  • 670
  • 671
  • 672
  • 673
  • 674
  • 675
  • 676
  • 677
  • 678
  • 679
  • 680
  • 681
  • 682
  • 683
  • 684
  • 685
  • 686
  • 687
  • 688
  • 689
  • 690
  • 691
  • 692
  • 693
  • 694
  • 695
  • 696
  • 697
  • 698
  • 699
  • 700
  • 701
  • 702
  • 703
  • 704
  • 705
  • 706
  • 707
  • 708
  • 709
  • 710
  • 711
  • 712
  • 713
  • 714
  • 715
  • 716
  • 717
  • 718
  • 719
  • 720
  • 721
  • 722
  • 723
  • 724
  • 725
  • 726
  • 727
  • 728
  • 729
  • 730
  • 731
  • 732
  • 733
  • 734
  • 735
  • 736
  • 737
  • 738
  • 739
  • 740
  • 741
  • 742
  • 743
  • 744
  • 745
  • 746
  • 747
  • 748
  • 749
  • 750
  • 751
  • 752
  • 753
  • 754
  • 755
  • 756
  • 757
  • 758
  • 759
  • 760
  • 761
  • 762
  • 763
  • 764
  • 765
  • 766
  • 767
  • 768
  • 769
  • 770
  • 771
  • 772
  • 773
  • 774
  • 775
  • 776
  • 777
  • 778
  • 779
  • 780
  • 781
  • 782
  • 783
  • 784
  • 785
  • 786
  • 787
  • 788
  • 789
  • 790
  • 791
  • 792
  • 793
  • 794
  • 795
  • 796
  • 797
  • 798
  • 799
  • 800
  • 801
  • 802
  • 803
  • 804
  • 805
  • 806
  • 807
  • 808
  • 809
  • 810
  • 811
  • 812
  • 813
  • 814
  • 815
  • 816
  • 817
  • 818
  • 819
  • 820
  • 821
  • 822
  • 823
  • 824
  • 825
  • 826
  • 827
  • 828
  • 829
  • 830
  • 831
  • 832
  • 833
  • 834
  • 835
  • 836
  • 837
  • 838
  • 839
  • 840
  • 841
  • 842
  • 843
  • 844
  • 845
  • 846
  • 847
  • 848
  • 849
  • 850
  • 851
  • 852
  • 853
  • 854
  • 855
  • 856
  • 857
  • 858
  • 859
  • 860
  • 861
  • 862
  • 863
  • 864
  • 865
  • 866
  • 867
  • 868
  • 869
  • 870
  • 871
  • 872
  • 873
  • 874
  • 875
  • 876
  • 877
  • 878
  • 879
  • 880
  • 881
  • 882
  • 883
  • 884
  • 885
  • 886
  • 887
  • 888
  • 889
  • 890
  • 891
  • 892
  • 893
  • 894
  • 895
  • 896
  • 897
  • 898
  • 899
  • 900
  • 901
  • 902
  • 903
  • 904
  • 905
  • 906
  • 907
  • 908
  • 909
  • 910
  • 911
  • 912
  • 913
  • 914
  • 915
  • 916
  • 917
  • 918
  • 919
  • 920
  • 921
  • 922
  • 923
  • 924
  • 925
  • 926
  • 927
  • 928
  • 929
  • 930
  • 931
  • 932
  • 933
  • 934
  • 935
  • 936
  • 937
  • 938
  • 939
  • 940
  • 941
  • 942
  • 943
  • 944
  • 945
  • 946
  • 947
  • 948
  • 949
  • 950
  • 951
  • 952
  • 953
  • 954
  • 955
  • 956
  • 957
  • 958
  • 959
  • 960
  • 961
  • 962
  • 963
  • 964
  • 965
  • 966
  • 967
  • 968
  • 969
  • 970
  • 971
  • 972
  • 973
  • 974
  • 975
  • 976
  • 977
  • 978
  • 979
  • 980
  • 981
  • 982
  • 983
  • 984
  • 985
  • 986
  • 987
  • 988
  • 989
  • 990
  • 991
  • 992
  • 993
  • 994
  • 995
  • 996
  • 997
  • 998
  • 999
  • title
    /usr/bin/nodejs
  • version
    v0.10.25
  • moduleLoadList
    Binding evals,Binding natives,NativeModule events,NativeModule buffer,Binding buffer,NativeModule assert,NativeModule util,NativeModule child_process,NativeModule string_decoder,NativeModule net,NativeModule stream,NativeModule _stream_readable,NativeModule _stream_writable,NativeModule _stream_duplex,NativeModule _stream_transform,NativeModule _stream_passthrough,NativeModule timers,Binding timer_wrap,NativeModule _linklist,Binding cares_wrap,NativeModule dgram,Binding udp_wrap,Binding process_wrap,Binding tcp_wrap,Binding pipe_wrap,NativeModule path,NativeModule module,NativeModule fs,Binding fs,Binding constants,NativeModule vm,NativeModule console,Binding tty_wrap,NativeModule tty,Binding signal_wrap
  • versions
    [object Object]
  • arch
    x64
  • platform
    linux
  • argv
    /usr/bin/nodejs,/WWW/pennyworth/lib/processors
  • execArgv
  • env
    [object Object]
  • pid
    9559
  • features
    [object Object]
  • _needImmediateCallback
    false
  • execPath
    /usr/bin/nodejs
  • debugPort
    5858
  • _getActiveRequests
    function () { [native code] }
  • _getActiveHandles
    function () { [native code] }
  • _needTickCallback
    function () { [native code] }
  • reallyExit
    function () { [native code] }
  • abort
    function () { [native code] }
  • chdir
    function () { [native code] }
  • cwd
    function () { [native code] }
  • umask
    function () { [native code] }
  • getuid
    function () { [native code] }
  • setuid
    function () { [native code] }
  • setgid
    function () { [native code] }
  • getgid
    function () { [native code] }
  • getgroups
    function () { [native code] }
  • setgroups
    function () { [native code] }
  • initgroups
    function () { [native code] }
  • _kill
    function () { [native code] }
  • _debugProcess
    function () { [native code] }
  • _debugPause
    function () { [native code] }
  • _debugEnd
    function () { [native code] }
  • hrtime
    function () { [native code] }
  • dlopen
    function () { [native code] }
  • uptime
    function () { [native code] }
  • memoryUsage
    function () { [native code] }
  • binding
    function () { [native code] }
  • _usingDomains
    function () { [native code] }
  • _tickInfoBox
    [object Object]
  • _events
    [object Object]
  • domain
  • _maxListeners
    10
  • EventEmitter
    function EventEmitter() {
      this.domain = null;
      if (exports.usingDomains) {
        // if there is an active domain, then attach to it.
        domain = domain || require('domain');
        if (domain.active && !(this instanceof domain.Domain)) {
          this.domain = domain.active;
        }
      }
      this._events = this._events || {};
      this._maxListeners = this._maxListeners || defaultMaxListeners;
    }
  • _fatalException
    function (er) {
          var caught = false;
          if (process.domain) {
            var domain = process.domain;
            var domainModule = NativeModule.require('domain');
            var domainStack = domainModule._stack;
    
            // ignore errors on disposed domains.
            //
            // XXX This is a bit stupid.  We should probably get rid of
            // domain.dispose() altogether.  It's almost always a terrible
            // idea.  --isaacs
            if (domain._disposed)
              return true;
    
            er.domain = domain;
            er.domainThrown = true;
            // wrap this in a try/catch so we don't get infinite throwing
            try {
              // One of three things will happen here.
              //
              // 1. There is a handler, caught = true
              // 2. There is no handler, caught = false
              // 3. It throws, caught = false
              //
              // If caught is false after this, then there's no need to exit()
              // the domain, because we're going to crash the process anyway.
              caught = domain.emit('error', er);
    
              // Exit all domains on the stack.  Uncaught exceptions end the
              // current tick and no domains should be left on the stack
              // between ticks.
              var domainModule = NativeModule.require('domain');
              domainStack.length = 0;
              domainModule.active = process.domain = null;
            } catch (er2) {
              // The domain error handler threw!  oh no!
              // See if another domain can catch THIS error,
              // or else crash on the original one.
              // If the user already exited it, then don't double-exit.
              if (domain === domainModule.active)
                domainStack.pop();
              if (domainStack.length) {
                var parentDomain = domainStack[domainStack.length - 1];
                process.domain = domainModule.active = parentDomain;
                caught = process._fatalException(er2);
              } else
                caught = false;
            }
          } else {
            caught = process.emit('uncaughtException', er);
          }
          // if someone handled it, then great.  otherwise, die in C++ land
          // since that means that we'll exit the process, emit the 'exit' event
          if (!caught) {
            try {
              if (!process._exiting) {
                process._exiting = true;
                process.emit('exit', 1);
              }
            } catch (er) {
              // nothing to be done about it at this point.
            }
          }
          // if we handled an error, then make sure any ticks get processed
          if (caught)
            process._needTickCallback();
          return caught;
        }
  • _exiting
    false
  • assert
    function (x, msg) {
          if (!x) throw new Error(msg || 'assertion error');
        }
  • config
    [object Object]
  • nextTick
    function nextTick(callback) {
          // on the way out, don't bother. it won't get fired anyway.
          if (process._exiting)
            return;
          if (infoBox[depth] >= process.maxTickDepth)
            maxTickWarn();
    
          var obj = { callback: callback, domain: null };
    
          nextTickQueue.push(obj);
          infoBox[length]++;
    
          if (needSpinner) {
            _needTickCallback();
            needSpinner = false;
          }
        }
  • _nextDomainTick
    function _nextDomainTick(callback) {
          // on the way out, don't bother. it won't get fired anyway.
          if (process._exiting)
            return;
          if (infoBox[depth] >= process.maxTickDepth)
            maxTickWarn();
    
          var obj = { callback: callback, domain: process.domain };
    
          nextTickQueue.push(obj);
          infoBox[length]++;
    
          if (needSpinner) {
            _needTickCallback();
            needSpinner = false;
          }
        }
  • _tickCallback
    function _tickCallback() {
          var callback, nextTickLength, threw;
    
          if (inTick) return;
          if (infoBox[length] === 0) {
            infoBox[index] = 0;
            infoBox[depth] = 0;
            return;
          }
          inTick = true;
    
          while (infoBox[depth]++ < process.maxTickDepth) {
            nextTickLength = infoBox[length];
            if (infoBox[index] === nextTickLength)
              return tickDone(0);
    
            while (infoBox[index] < nextTickLength) {
              callback = nextTickQueue[infoBox[index]++].callback;
              threw = true;
              try {
                callback();
                threw = false;
              } finally {
                if (threw) tickDone(infoBox[depth]);
              }
            }
          }
    
          tickDone(0);
        }
  • _tickDomainCallback
    function _tickDomainCallback() {
          var nextTickLength, tock, callback, threw;
    
          // if you add a nextTick in a domain's error handler, then
          // it's possible to cycle indefinitely.  Normally, the tickDone
          // in the finally{} block below will prevent this, however if
          // that error handler ALSO triggers multiple MakeCallbacks, then
          // it'll try to keep clearing the queue, since the finally block
          // fires *before* the error hits the top level and is handled.
          if (infoBox[depth] >= process.maxTickDepth)
            return _needTickCallback();
    
          if (inTick) return;
          inTick = true;
    
          // always do this at least once.  otherwise if process.maxTickDepth
          // is set to some negative value, or if there were repeated errors
          // preventing depth from being cleared, we'd never process any
          // of them.
          while (infoBox[depth]++ < process.maxTickDepth) {
            nextTickLength = infoBox[length];
            if (infoBox[index] === nextTickLength)
              return tickDone(0);
    
            while (infoBox[index] < nextTickLength) {
              tock = nextTickQueue[infoBox[index]++];
              callback = tock.callback;
              if (tock.domain) {
                if (tock.domain._disposed) continue;
                tock.domain.enter();
              }
              threw = true;
              try {
                callback();
                threw = false;
              } finally {
                // finally blocks fire before the error hits the top level,
                // so we can't clear the depth at this point.
                if (threw) tickDone(infoBox[depth]);
              }
              if (tock.domain) {
                tock.domain.exit();
              }
            }
          }
    
          tickDone(0);
        }
  • _tickFromSpinner
    function _tickFromSpinner() {
          needSpinner = true;
          // coming from spinner, reset!
          if (infoBox[depth] !== 0)
            infoBox[depth] = 0;
          // no callbacks to run
          if (infoBox[length] === 0)
            return infoBox[index] = infoBox[depth] = 0;
          process._tickCallback();
        }
  • maxTickDepth
    1000
  • stdout
    [object Object]
  • stderr
    [object Object]
  • stdin
    [object Object]
  • openStdin
    function () {
          process.stdin.resume();
          return process.stdin;
        }
  • exit
    function (code) {
          if (!process._exiting) {
            process._exiting = true;
            process.emit('exit', code || 0);
          }
          process.reallyExit(code || 0);
        }
  • kill
    function (pid, sig) {
          var r;
    
          // preserve null signal
          if (0 === sig) {
            r = process._kill(pid, 0);
          } else {
            sig = sig || 'SIGTERM';
            if (startup.lazyConstants()[sig] &&
                sig.slice(0, 3) === 'SIG') {
              r = process._kill(pid, startup.lazyConstants()[sig]);
            } else {
              throw new Error('Unknown signal: ' + sig);
            }
          }
    
          if (r) {
            throw errnoException(process._errno, 'kill');
          }
    
          return true;
        }
  • addListener
    function (type, listener) {
          if (isSignal(type) &&
              !signalWraps.hasOwnProperty(type)) {
            var Signal = process.binding('signal_wrap').Signal;
            var wrap = new Signal();
    
            wrap.unref();
    
            wrap.onsignal = function() { process.emit(type); };
    
            var signum = startup.lazyConstants()[type];
            var r = wrap.start(signum);
            if (r) {
              wrap.close();
              throw errnoException(process._errno, 'uv_signal_start');
            }
    
            signalWraps[type] = wrap;
          }
    
          return addListener.apply(this, arguments);
        }
  • on
    function (type, listener) {
          if (isSignal(type) &&
              !signalWraps.hasOwnProperty(type)) {
            var Signal = process.binding('signal_wrap').Signal;
            var wrap = new Signal();
    
            wrap.unref();
    
            wrap.onsignal = function() { process.emit(type); };
    
            var signum = startup.lazyConstants()[type];
            var r = wrap.start(signum);
            if (r) {
              wrap.close();
              throw errnoException(process._errno, 'uv_signal_start');
            }
    
            signalWraps[type] = wrap;
          }
    
          return addListener.apply(this, arguments);
        }
  • removeListener
    function (type, listener) {
          var ret = removeListener.apply(this, arguments);
          if (isSignal(type)) {
            assert(signalWraps.hasOwnProperty(type));
    
            if (this.listeners(type).length === 0) {
              signalWraps[type].close();
              delete signalWraps[type];
            }
          }
    
          return ret;
        }
  • _channel
    [object Pipe]
  • _handleQueue
  • send
    function (message, handle) {
        if (typeof message === 'undefined') {
          throw new TypeError('message cannot be undefined');
        }
    
        if (!this.connected) {
          this.emit('error', new Error('channel closed'));
          return;
        }
    
        // package messages with a handle object
        if (handle) {
          // this message will be handled by an internalMessage event handler
          message = {
            cmd: 'NODE_HANDLE',
            type: null,
            msg: message
          };
    
          if (handle instanceof net.Socket) {
            message.type = 'net.Socket';
          } else if (handle instanceof net.Server) {
            message.type = 'net.Server';
          } else if (handle instanceof process.binding('tcp_wrap').TCP ||
                     handle instanceof process.binding('pipe_wrap').Pipe) {
            message.type = 'net.Native';
          } else if (handle instanceof dgram.Socket) {
            message.type = 'dgram.Socket';
          } else if (handle instanceof process.binding('udp_wrap').UDP) {
            message.type = 'dgram.Native';
          } else {
            throw new TypeError("This handle type can't be sent");
          }
    
          // Queue-up message and handle if we haven't received ACK yet.
          if (this._handleQueue) {
            this._handleQueue.push({ message: message.msg, handle: handle });
            return;
          }
    
          var obj = handleConversion[message.type];
    
          // convert TCP object to native handle object
          handle = handleConversion[message.type].send.apply(target, arguments);
    
          // Update simultaneous accepts on Windows
          if (obj.simultaneousAccepts) {
            net._setSimultaneousAccepts(handle);
          }
        } else if (this._handleQueue) {
          // Queue request anyway to avoid out-of-order messages.
          this._handleQueue.push({ message: message, handle: null });
          return;
        }
    
        var string = JSON.stringify(message) + '\n';
        var writeReq = channel.writeUtf8String(string, handle);
    
        if (!writeReq) {
          var er = errnoException(process._errno,
                                  'write',
                                  'cannot write to IPC channel.');
          this.emit('error', er);
        } else if (handle && !this._handleQueue) {
          this._handleQueue = [];
        }
    
        if (obj && obj.postSend) {
          writeReq.oncomplete = obj.postSend.bind(null, handle);
        } else {
          writeReq.oncomplete = nop;
        }
    
        /* If the master is > 2 read() calls behind, please stop sending. */
        return channel.writeQueueSize < (65536 * 2);
      }
  • connected
    true
  • disconnect
    function () {
        if (!this.connected) {
          this.emit('error', new Error('IPC channel is already disconnected'));
          return;
        }
    
        // do not allow messages to be written
        this.connected = false;
        this._channel = null;
    
        var fired = false;
        function finish() {
          if (fired) return;
          fired = true;
    
          channel.close();
          target.emit('disconnect');
        }
    
        // If a message is being read, then wait for it to complete.
        if (channel.buffering) {
          this.once('message', finish);
          this.once('internalMessage', finish);
    
          return;
        }
    
        finish();
      }
  • mainModule
    [object Object]
  • setMaxListeners
    function (n) {
      if (typeof n !== 'number' || n < 0 || isNaN(n))
        throw TypeError('n must be a positive number');
      this._maxListeners = n;
    }
  • emit
    function (type) {
      var er, handler, len, args, i, listeners;
    
      if (!this._events)
        this._events = {};
    
      // If there is no 'error' event listener then throw.
      if (type === 'error') {
        if (!this._events.error ||
            (typeof this._events.error === 'object' &&
             !this._events.error.length)) {
          er = arguments[1];
          if (this.domain) {
            if (!er) er = new TypeError('Uncaught, unspecified "error" event.');
            er.domainEmitter = this;
            er.domain = this.domain;
            er.domainThrown = false;
            this.domain.emit('error', er);
          } else if (er instanceof Error) {
            throw er; // Unhandled 'error' event
          } else {
            throw TypeError('Uncaught, unspecified "error" event.');
          }
          return false;
        }
      }
    
      handler = this._events[type];
    
      if (typeof handler === 'undefined')
        return false;
    
      if (this.domain && this !== process)
        this.domain.enter();
    
      if (typeof handler === 'function') {
        switch (arguments.length) {
          // fast cases
          case 1:
            handler.call(this);
            break;
          case 2:
            handler.call(this, arguments[1]);
            break;
          case 3:
            handler.call(this, arguments[1], arguments[2]);
            break;
          // slower
          default:
            len = arguments.length;
            args = new Array(len - 1);
            for (i = 1; i < len; i++)
              args[i - 1] = arguments[i];
            handler.apply(this, args);
        }
      } else if (typeof handler === 'object') {
        len = arguments.length;
        args = new Array(len - 1);
        for (i = 1; i < len; i++)
          args[i - 1] = arguments[i];
    
        listeners = handler.slice();
        len = listeners.length;
        for (i = 0; i < len; i++)
          listeners[i].apply(this, args);
      }
    
      if (this.domain && this !== process)
        this.domain.exit();
    
      return true;
    }
  • once
    function (type, listener) {
      if (typeof listener !== 'function')
        throw TypeError('listener must be a function');
    
      var fired = false;
    
      function g() {
        this.removeListener(type, g);
    
        if (!fired) {
          fired = true;
          listener.apply(this, arguments);
        }
      }
    
      g.listener = listener;
      this.on(type, g);
    
      return this;
    }
  • removeAllListeners
    function (type) {
      var key, listeners;
    
      if (!this._events)
        return this;
    
      // not listening for removeListener, no need to emit
      if (!this._events.removeListener) {
        if (arguments.length === 0)
          this._events = {};
        else if (this._events[type])
          delete this._events[type];
        return this;
      }
    
      // emit removeListener for all listeners on all events
      if (arguments.length === 0) {
        for (key in this._events) {
          if (key === 'removeListener') continue;
          this.removeAllListeners(key);
        }
        this.removeAllListeners('removeListener');
        this._events = {};
        return this;
      }
    
      listeners = this._events[type];
    
      if (typeof listeners === 'function') {
        this.removeListener(type, listeners);
      } else if (Array.isArray(listeners)) {
        // LIFO order
        while (listeners.length)
          this.removeListener(type, listeners[listeners.length - 1]);
      }
      delete this._events[type];
    
      return this;
    }
  • listeners
    function (type) {
      var ret;
      if (!this._events || !this._events[type])
        ret = [];
      else if (typeof this._events[type] === 'function')
        ret = [this._events[type]];
      else
        ret = this._events[type].slice();
      return ret;
    }