Skip to content

TypeError while running Exercise 13 (DUPLEXER) and 14 (DUPLEXER REDUX) #271

Description

@antosant1981

Hello,

I had the follwing error while trying ro run (and verify) exercises 13 and 14:

this.submissionChild = this.submissionFn(this.submissionArgs)
                                ^
TypeError: this.submissionFn is not a function
    at Exercise.<anonymous> (C:\Users\anton\AppData\Roaming\npm\node_modules\stream-adventure\lib\exportFnExercise.js:29:33)
    at next (C:\Users\anton\AppData\Roaming\npm\node_modules\stream-adventure\node_modules\workshopper-exercise\exercise.js:170:19)
    at Exercise.process (C:\Users\anton\AppData\Roaming\npm\node_modules\stream-adventure\node_modules\workshopper-exercise\exercise.js:177:5)
    at Exercise.<anonymous> (C:\Users\anton\AppData\Roaming\npm\node_modules\stream-adventure\node_modules\workshopper-exercise\exercise.js:147:10)
    at processTicksAndRejections (node:internal/process/task_queues:78:11)

Find below the code of the challenge 13.

This is the script with the function to export (named child.js):

const { spawn } = require('child_process');
const duplexer2 = require('duplexer2');


module.exports = function (cmd, args, opts) {
    // spawn the process and return a single stream
    const command = spawn(cmd, args, opts);

    // readable is obtained using the command stdout
    const readable = command.stdout;

    // writable is obtained using the command stdin
    const writable = command.stdin;

    // joining together the stdin and stdout here
    return duplexer2(writable, readable);
  }

This is the script that uses the function exported:

const child = require('./child');

const command = child('dir', [], { shell: true });

command.pipe(process.stdout);

Can you tell me what's wrong please and possibly suggest a solution?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions