X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=src%2Fapi%2Finternal%2Fio%2FBamPipe_p.cpp;fp=src%2Fapi%2Finternal%2Fio%2FBamPipe_p.cpp;h=6af4af146410df491b01ee8f74937369fa12f27c;hb=bafc03f4ed7ed9ff1b3fb24874dc8a4a6d58e605;hp=2d571fd4c2500adbce043f59065a80f3ddc1efad;hpb=e235c55e4a2c5d88d13c932206db90991fa093e0;p=bamtools.git diff --git a/src/api/internal/io/BamPipe_p.cpp b/src/api/internal/io/BamPipe_p.cpp index 2d571fd..6af4af1 100644 --- a/src/api/internal/io/BamPipe_p.cpp +++ b/src/api/internal/io/BamPipe_p.cpp @@ -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" );