index.js
function getMachineEnv(machine) {
  var child = require('child_process');
  var result = child.spawnSync('docker-machine', ['env', machine]);

  if (result.status === 0) {
    var str = result.stdout.toString();
    var expr = str
      .replace(new RegExp('export ', 'g'), 'envs.')
      .split('\n')
      .filter(function (line) {
        return line[0] !== '#';
      }).join(';')

    var envs = {};
    eval(expr);
    return envs;
  } else {
    throw Error(result.stderr)
  }
}
function getMachineEnv(machine) {
  var child = require('child_process');
  var result = child.spawnSync('docker-machine', ['env', machine]);

  if (result.status === 0) {
    var str = result.stdout.toString();
    var expr = str
      .replace(new RegExp('export ', 'g'), 'envs.')
      .split('\n')
      .filter(function (line) {
        return line[0] !== '#';
      }).join(';')

    var envs = {};
    eval(expr);
    return envs;
  } else {
    throw Error(result.stderr)
  }
}
function getMachineEnv ( machine ) { var child = require ( 'child_process' ) ; var result = child . spawnSync ( 'docker-machine' , [ 'env' , machine ] ) ; if ( result . status === 0 ) { var str = result . stdout . toString ( ) ; var expr = str . replace ( new RegExp ( 'export ' , 'g' ) , 'envs.' ) . split ( '\n' ) . filter ( function ( line ) { return line [ 0 ] !== '#' ; } ) . join ( ';' ) var envs = { } ; eval ( expr ) ; return envs ; } else { throw Error ( result . stderr ) } }
Returns the env vars for the given docker machine.
Returns the env vars for the given docker machine .