Skip to content

process.stdin is not implemented in bash for Windows 10... unknown type #8839

Closed
@catdad

Description

@catdad
  • Version: 6.4.0 and 4.5.0 tested
  • Platform: bash on Windows 10 64bit
  • Subsystem: stdio (I think?)

uname output, just in case: Linux WHITSON 3.4.0+ #1 PREEMPT Thu Aug 1 17:06:05 CST 2013 x86_64 x86_64 x86_64

Repro code:

var exec = require('child_process').exec;
var fs = require('fs');

var stream = fs.createReadStream('./repro.js');

var child = exec(
    'node -e "process.stdin.pipe(process.stdout)"',
    { cwd: process.cwd() },
    console.log.bind(console, 'result args:')
);

stream.pipe(child.stdin);

I named this file repro.js... yes, it reads itself, but any stream will reproduce this error.

Then run: node repro.js

This will output:

kiril@WHITSON:~/temp$ node repro.js
result args: { [Error: Command failed: /bin/sh -c node -e "process.stdin.pipe(process.stdout)"
node.js:708
          throw new Error('Implement me. Unknown stdin file type!');
          ^

Error: Implement me. Unknown stdin file type!
    at process.stdin (node.js:708:17)
    at [eval]:1:8
    at Object.exports.runInThisContext (vm.js:54:17)
    at Object.<anonymous> ([eval]-wrapper:6:22)
    at Module._compile (module.js:409:26)
    at node.js:579:27
    at nextTickCallbackWith0Args (node.js:420:9)
    at process._tickCallback (node.js:349:13)
]
  killed: false,
  code: 1,
  signal: null,
  cmd: '/bin/sh -c node -e "process.stdin.pipe(process.stdout)"' }  node.js:708
          throw new Error('Implement me. Unknown stdin file type!');
          ^

Error: Implement me. Unknown stdin file type!
    at process.stdin (node.js:708:17)
    at [eval]:1:8
    at Object.exports.runInThisContext (vm.js:54:17)
    at Object.<anonymous> ([eval]-wrapper:6:22)
    at Module._compile (module.js:409:26)
    at node.js:579:27
    at nextTickCallbackWith0Args (node.js:420:9)
    at process._tickCallback (node.js:349:13)

This code works correctly (outputting the contents of the file itself) on regular Ubuntu and regular Windows, but not on the Linux subsystem in Windows 10.

This was discovered in catdad/shellton#11.

Same issue happens with spawn as well, obviously, but it's tougher to get the error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    child_processIssues and PRs related to the child_process subsystem.libuvIssues and PRs related to the libuv dependency or the uv binding.processIssues and PRs related to the process subsystem.windowsIssues and PRs related to the Windows platform.wslIssues and PRs related to the Windows Subsystem for Linux.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions