Closed max-mapper closed 11 years ago
ahh yeah heres the test suite output:
pizzacats:procstreams maxogden$ npm test
> procstreams@0.2.0 test /Users/maxogden/src/node-mdb/node_modules/procstreams
> tests/run_tests.sh
tests/test-arguments.js
assert.js:104
throw new assert.AssertionError({
^
AssertionError: "v0.8.0" == ""
at procStream.<anonymous> (/Users/maxogden/src/node-mdb/node_modules/procstreams/tests/test-arguments.js:16:14)
at procStream.EventEmitter.emit (events.js:98:17)
at procStream.<anonymous> (/Users/maxogden/src/node-mdb/node_modules/procstreams/procstreams.js:105:10)
at procStream.EventEmitter.emit (events.js:115:20)
at Process._handle.onexit (child_process.js:674:10)
------
tests/test-error.js
------
tests/test-methods.js
------
tests/test-operators.js
assert.js:104
throw new assert.AssertionError({
^
AssertionError: "pass2" == ""
at procStream.<anonymous> (/Users/maxogden/src/node-mdb/node_modules/procstreams/tests/test-operators.js:56:16)
at procStream.EventEmitter.emit (events.js:98:17)
at procStream.<anonymous> (/Users/maxogden/src/node-mdb/node_modules/procstreams/procstreams.js:105:10)
at procStream.EventEmitter.emit (events.js:91:17)
at Process._handle.onexit (child_process.js:674:10)
------
tests/test-pipe.js
assert.js:104
throw new assert.AssertionError({
^
AssertionError: "3" == ""
at procStream.<anonymous> (/Users/maxogden/src/node-mdb/node_modules/procstreams/tests/test-pipe.js:14:14)
at procStream.EventEmitter.emit (events.js:98:17)
at procStream.<anonymous> (/Users/maxogden/src/node-mdb/node_modules/procstreams/procstreams.js:105:10)
at procStream.EventEmitter.emit (events.js:115:20)
at Process._handle.onexit (child_process.js:674:10)
------
tests/test-promises.js
three
assert.js:104
throw new assert.AssertionError({
^
AssertionError: "three" == ""
at procStream.<anonymous> (/Users/maxogden/src/node-mdb/node_modules/procstreams/tests/test-promises.js:15:14)
at procStream.EventEmitter.emit (events.js:98:17)
at procStream.<anonymous> (/Users/maxogden/src/node-mdb/node_modules/procstreams/procstreams.js:105:10)
at procStream.EventEmitter.emit (events.js:91:17)
at Process._handle.onexit (child_process.js:674:10)
------
tests/test-simple.js
------
4 tests failed
so it looks like when you call pipe
on a procstream it hits this code path:
https://github.com/polotek/procstreams/blob/master/procstreams.js#L244
which then calls the procStream(cmd, args, opts, callback)
function again but with cmd
set to a stream
inside normalizeArguments
it only wants cmd
to be a string or array so it throws the invalid command error. why is it calling procStream with cmd set to a stream?
oh I think i'm misunderstanding this module
I found this easier FWIW: https://github.com/maxogden/node-mdb/commit/a6f425ed8045fd294cd1579327149b0996945533#L0L15
Yeah the api has definitely not achieved it's goal of being nicer than the core api in most respects. I haven't really updated it in a long time.
The problem with this is that you're trying to pass a stream instead of a proc or a proc command. I'm going to add support for piping to streams. It's less than trivial if we want to support piping from a stream into a procstream. Because we have to override the default pipe method and still have things act sensibly. For now, I've at least added a more sensible error message.
Okay this should be fixed. Procs should be mostly compatible with normal streams, so you can pipe back and forth between them. I'm doing a release soon. If you use it again, let me know how it works. Also take a look at the api. the out()
and data()
methods cover most people use cases for getting output.
not sure what i'm doin wrong
results in: