]> git.donarmstrong.com Git - bamtools.git/blobdiff - src/api/internal/io/BamPipe_p.cpp
Version 2.2
[bamtools.git] / src / api / internal / io / BamPipe_p.cpp
index 2d571fd4c2500adbce043f59065a80f3ddc1efad..6af4af146410df491b01ee8f74937369fa12f27c 100644 (file)
@@ -2,7 +2,7 @@
 // BamPipe_p.cpp (c) 2011 Derek Barnett
 // Marth Lab, Department of Biology, Boston College
 // ---------------------------------------------------------------------------
-// Last modified: 10 November 2011 (DB)
+// Last modified: 18 October 2012 (DB)
 // ---------------------------------------------------------------------------
 // Provides BAM pipe-specific IO behavior
 // ***************************************************************************
@@ -29,10 +29,18 @@ bool BamPipe::Open(const IBamIODevice::OpenMode mode) {
     Close();
 
     // open stdin/stdout depending on requested openmode
+#if defined( SYSTEM_NODEJS ) && SYSTEM_NODEJS == 1
+    if ( mode == IBamIODevice::ReadOnly )
+        m_stream = stdin;
+    else if ( mode == IBamIODevice::WriteOnly )
+        m_stream = stdout;
+#else
     if ( mode == IBamIODevice::ReadOnly )
         m_stream = freopen(0, "rb", stdin);
     else if ( mode == IBamIODevice::WriteOnly )
         m_stream = freopen(0, "wb", stdout);
+#endif // SYSTEM_NODEJS
+
     else {
         const string errorType = string( (mode == IBamIODevice::ReadWrite) ? "unsupported"
                                                                            : "unknown" );