dundalek / closh

Bash-like shell based on Clojure
Eclipse Public License 1.0
1.62k stars 66 forks source link

`closh` starts Lumo after installation to $HOME #49

Closed ghost closed 6 years ago

ghost commented 6 years ago

I installed Closh like this:

$ cd $HOME
$ npm install lumo-cljs closh
$ export "PATH=$HOME/node_modules/.bin:$PATH"

Afterwards, executing closh drops me into a Lumo REPL instead of Closh:

$ closh
Lumo 1.0.0-alpha3
ClojureScript 1.9.293
 Exit: Control+D or :cljs/quit or exit
cljs.user=>

The generated file $HOME/node_modules/.bin/closh does not appear to be terribly wrong:

#!/usr/bin/env node
'use strict';
var spawn = require('child_process').spawn;
var path = require('path');
var os = require('os');
var fs = require('fs');

var isWindows = /^win/.test(process.platform);
var bin = isWindows ? 'lumo.cmd' : 'lumo';
var args = [
  '--classpath', path.join(__dirname, '..', 'src'),
  '--cache', path.join(os.homedir(), '.lumo_cache'),
  '-m', 'closh.main',
];

// NODE_PATH seems to be missing when running as global binary
var paths = [
  path.join(__dirname, '..', 'node_modules'),
  path.join(__dirname, '..', '..')
];
if (process.env.NODE_PATH) {
  paths.push(process.env.NODE_PATH);
}
process.env.NODE_PATH = paths.join(isWindows ? ';' : ':');

spawn(bin, args, { stdio: 'inherit' }).on('exit', process.exit);
dundalek commented 6 years ago

It is strange that you end up running Lumo 1.0 when the latest version is 1.8.0-beta. Maybe you have some previously installed version that shadows the recent one? What does the command which lumo show you?

ghost commented 6 years ago

That points to $HOME/.local/bin/lumo. After deleting that file, I end up in a shell as expected. Thanks for the hint!