Open lilactown opened 6 years ago
I get the same
lumo -e '(-> (js/require "shelljs") (.exec "ls"))'
(node:9361) UnhandledPromiseRejectionWarning: Error: This file should not be required
at Object.<anonymous> (/home/hlolli/Music/erkitid_2018/node_modules/shelljs/src/exec-child.js:2:9)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.yt [as eval] ([eval]:1:33012)
at Object.lumo.repl.caching_node_eval (<embedded>:6477:68)
at <embedded>:6605:454
at Object.lumo.repl.run_sync_BANG_ [as run_async_BANG_] (<embedded>:6451:108)
at Object.cljs.js.process_deps (<embedded>:5816:185)
at Object.cljs.js.process_libs_deps (<embedded>:5819:60)
at <embedded>:6604:424
at Object.lumo.repl.run_sync_BANG_ [as run_async_BANG_] (<embedded>:6451:108)
(node:9361) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:9361) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
ENOENT: no such file or directory, open '/tmp/shelljs_3c357cb12430abedd941'
Object.openSync (fs.cljs:443:3)
Object.readFileSync (fs.cljs:348:35)
execSync (/home/hlolli/Music/erkitid_2018/node_modules/shelljs/src/exec.cljs:89:17)
Object._exec (/home/hlolli/Music/erkitid_2018/node_modules/shelljs/src/exec.cljs:202:12)
Object.exec (/home/hlolli/Music/erkitid_2018/node_modules/shelljs/src/common.cljs:335:23)
(evalmachine.<anonymous>:1:20)
Script.runInThisContext (vm.cljs:91:20)
Object.runInThisContext (vm.cljs:298:38)
(Object.yt)
(Object.lumo.repl.caching_node_eval)
On the other hand, Nodejs doesn't do it
node -e 'let shelljs = require("shelljs"); shelljs.exec("ls");' ~/Music/erkitid_2018
node_modules
package.json
package-lock.json
shadow-cljs.edn
src
The code that "fails" is
$ cat node_modules/shelljs/src/exec-child.js
if (require.main !== module) {
throw new Error('This file should not be required');
}
...elided...
as far as I see, the demand of this library shelljs to have .exec only be used directly from the command line (as explained here https://stackoverflow.com/questions/45136831/node-js-require-main-module ) is perhaps a no-solve for a self-hosted clojurescript. But maybe there's a way to hack lumo so that it defers the require.main setter, if doing that could be consequent free thing to do.
🙄 I might just fork shelljs then. Seems inconsequential.
probably related to #285
Any update on this issue? I am also facing this issue. I am trying to use shelljs echo (to output something to a file) and exec methods to execute 'sudo update-ca-certificates'. I get an error "This file should not be required." in exec-child.js
I'm attempting to use shelljs for some command-line scripts.
Using the built-ins like
cd
andls
work fine. However, attempting to useexec
throws this strange error:Simple repro steps:
Lumo version: 1.9.0-alpha Node.js version: 8.9.1 and 10.3.0 Shelljs version: 0.8.2