Skip to content
This repository has been archived by the owner on Jun 4, 2022. It is now read-only.

"Invalid keyword" error when calling shelljs.exec from ClojureScript #285

Open
daviwil opened this issue Oct 1, 2017 · 3 comments
Open

Comments

@daviwil
Copy link

daviwil commented Oct 1, 2017

This could possibly be an issue with ClojureScript itself but I figured I'd start here. I'm trying to use the ShellJS library, specifically shelljs.exec, in a Lumo script and I'm receiving this error:

> lumo-shelljs-repro@1.0.0 start /home/daviwil/Projects/Code/lumo-shelljs-repro
> lumo repro.cljs

WARNING: Use of undeclared Var cljs.user/var at line 1 
WARNING: Use of undeclared Var cljs.user/child at line 1 
WARNING: Can't take value of macro cljs.core/require at line 1 
WARNING: Use of undeclared Var cljs.user/fs at line 2 
WARNING: Can't take value of macro cljs.core/require at line 2 
WARNING: Use of undeclared Var cljs.user/var at line 3 
WARNING: Use of undeclared Var cljs.user/childProcess at line 3 
           ⬆
/tmp/shelljs_2b64e6d0015dc597a80c [line 3, col 78] Invalid keyword: :. at line 3 /tmp/shelljs_2b64e6d0015dc597a80c
         (new)
         Function.cljs.core.ex_info.cljs$core$IFn$_invoke$arity$3 (NO_SOURCE_FILE <embedded>:1928:72)
         Function.cljs.core.ex_info.cljs$core$IFn$_invoke$arity$2 (NO_SOURCE_FILE <embedded>:1927:449)
         Function.cljs.tools.reader.impl.errors.throw_ex.cljs$core$IFn$_invoke$arity$variadic (NO_SOURCE_FILE <embedded>:2095:303)
         Function.cljs.tools.reader.impl.errors.reader_error.cljs$core$IFn$_invoke$arity$variadic (NO_SOURCE_FILE <embedded>:2098:141)
         Object.cljs.tools.reader.impl.errors.throw_invalid (NO_SOURCE_FILE <embedded>:2113:365)
         cljs.tools.reader.read_keyword (NO_SOURCE_FILE <embedded>:2197:405)
         Object.cljs.tools.reader.read_STAR__internal (NO_SOURCE_FILE <embedded>:2269:407)
         Function.cljs.tools.reader.read_STAR_.cljs$core$IFn$_invoke$arity$6 (NO_SOURCE_FILE <embedded>:2272:111)
         Object.cljs.tools.reader.read_delimited_internal (NO_SOURCE_FILE <embedded>:2171:427)

exec: internal error

It seems that ShellJS is generating a script and executing it in the same runtime, causing ClojureScript to get tripped up. Have you ever seen this before?

I've put together a very simple project that reproduces the issue, you can find it here:

https://github.com/daviwil/lumo-shelljs-repro

Happy to move this issue elsewhere if it doesn't belong here.

Thanks!

@anmonteiro
Copy link
Owner

This looks kinda weird, as if the library is trying to send JavaScript for Lumo to execute.

I would probably attribute this to the library, but it also reminds me of #53

@skynet-gh
Copy link

I ran into this as well, and am using this nodejs function as a workaround https://nodejs.org/api/child_process.html#child_process_child_process_execsync_command_options

@daviwil
Copy link
Author

daviwil commented Oct 6, 2017

@CraigY yep! that's what I ended up doing too :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants