ibmruntimes / node

This repository is moving to: https://github.com/ibmruntimes/node-zos
69 stars 24 forks source link

Failed to set shell for child_process.exec #91

Closed std3lqi closed 7 years ago

std3lqi commented 7 years ago

Hi,

We're using node-v6.11.0-os390-s390x, and find the '/bin/ksh' is hard-coded in child_process.exec(command[, options][, callback]) on z/OS. On the system where we don't have '/bin/ksh', we failed to set options.shell to '/bin/sh'. It looks like the code checking options.shell before setting it to '/bin/ksh' is missing on z/OS.

Thanks!

Qi

  if (options.shell) {
    const command = [file].concat(args).join(' ');

    if (process.platform === 'win32') {
      file = typeof options.shell === 'string' ? options.shell :
              process.env.comspec || 'cmd.exe';
      args = ['/s', '/c', '"' + command + '"'];
      options.windowsVerbatimArguments = true;
    } else if (process.platform === 'os390') {
      file = '/bin/ksh';  // <=============================
      args = ['-c', command];
    } else {
      if (typeof options.shell === 'string')
        file = options.shell;
      else if (process.platform === 'android')
        file = '/system/bin/sh';
      else
        file = '/bin/sh';
      args = ['-c', command];
    }
  }
jBarz commented 7 years ago

Thanks for the info. You are right, that should not be hard coded. This will be fixed in the next release.

jBarz commented 7 years ago

Fixed in https://github.com/ibmruntimes/node/commit/db1221e01aaa694ba596664a016a86539541cd36 The default /bin/sh should work just as well.

std3lqi commented 7 years ago

Thanks! I'll verify it in the next release.

jBarz commented 7 years ago

beta 3 should resolve this. https://developer.ibm.com/node/sdk/ztp/