deathcap / nodeachrome

run Node.js scripts in Google Chrome (experimental)
MIT License
2 stars 0 forks source link

Add cash (implementations of common Unix shell utilities in JavaScript) #22

Open deathcap opened 8 years ago

deathcap commented 8 years ago

An attempt towards https://github.com/deathcap/nodeachrome/issues/16 Pure JavaScript Node.js implementations of common shell CLI utilities

deathcap commented 8 years ago

Currently broken, cash seems to rely on a fair amount of dynamicism. Patched a few incompatibilities but now logs these failures:

rror loading command alias: ", Error: Cannot find module './commands/alias.js' at newRequire (chrome-extension://ldcjdgpgjjhmjo…] stdout.js:42 ["Error loading command cat: ", Error: Cannot find module './commands/cat.js' at newRequire (chrome-extension://ldcjdgpgjjhmjomf…] stdout.js:42 ["Error loading command cd: ", Error: Cannot find module './commands/cd.js' at newRequire (chrome-extension://ldcjdgpgjjhmjomfi…] stdout.js:42 ["Error loading command clear: ", Error: Cannot find module './commands/clear.js' at newRequire (chrome-extension://ldcjdgpgjjhmjo…] stdout.js:42 ["Error loading command cp: ", Error: Cannot find module './commands/cp.js' at newRequire (chrome-extension://ldcjdgpgjjhmjomfi…] stdout.js:42 ["Error loading command echo: ", Error: Cannot find module './commands/echo.js' at newRequire (chrome-extension://ldcjdgpgjjhmjom…] stdout.js:42 ["Error loading command head: ", Error: Cannot find module './commands/head.js' at newRequire (chrome-extension://ldcjdgpgjjhmjom…] stdout.js:42 ["Error loading command export: ", Error: Cannot find module './commands/export.js' at newRequire (chrome-extension://ldcjdgpgjjhmj…] stdout.js:42 ["Error loading command false: ", Error: Cannot find module './commands/false.js' at newRequire (chrome-extension://ldcjdgpgjjhmjo…] stdout.js:42 ["Error loading command kill: ", Error: Cannot find module './commands/kill.js' at newRequire (chrome-extension://ldcjdgpgjjhmjom…] stdout.js:42["Error loading command ls: ", Error: Cannot find module './commands/ls.js' at newRequire (chrome-extension://ldcjdgpgjjhmjomfi…] stdout.js:42["Error loading command mkdir: ", Error: Cannot find module './commands/mkdir.js' at newRequire (chrome-extension://ldcjdgpgjjhmjo…] stdout.js:42["Error loading command mv: ", Error: Cannot find module './commands/mv.js' at newRequire (chrome-extension://ldcjdgpgjjhmjomfi…] stdout.js:42["Error loading command pwd: ", Error: Cannot find module './commands/pwd.js' at newRequire (chrome-extension://ldcjdgpgjjhmjomf…] stdout.js:42["Error loading command sort: ", Error: Cannot find module './commands/sort.js' at newRequire (chrome-extension://ldcjdgpgjjhmjom…] stdout.js:42["Error loading command source: ", Error: Cannot find module './commands/source.js' at newRequire (chrome-extension://ldcjdgpgjjhmj…] stdout.js:42["Error loading command tail: ", Error: Cannot find module './commands/tail.js' at newRequire (chrome-extension://ldcjdgpgjjhmjom…] stdout.js:42["Error loading command touch: ", Error: Cannot find module './commands/touch.js' at newRequire (chrome-extension://ldcjdgpgjjhmjo…] stdout.js:42["Error loading command true: ", Error: Cannot find module './commands/true.js' at newRequire (chrome-extension://ldcjdgpgjjhmjom…] stdout.js:42["Error loading command rm: ", Error: Cannot find module './commands/rm.js' at newRequire (chrome-extension://ldcjdgpgjjhmjomfi…] stdout.js:42["Error loading command unalias: ", Error: Cannot find module './commands/unalias.js' at newRequire (chrome-extension://ldcjdgpgjjhm…] stdout.js:42["Error loading command less: ", Error: Cannot find module 'vorpal-less' at newRequire (chrome-extension://ldcjdgpgjjhmjomfiekbme…] stdout.js:42["Error loading command grep: ", Error: Cannot find module 'vorpal-grep' at newRequire (chrome-extension://ldcjdgpgjjhmjomfiekbme…]

and it tries to fs.mkdirSync before the process has begun (received _start message), so kernelSource is undefined in userland/syscall.js, so it cannot send up to the native fs yet. Maybe try developing a simplified version of a few needed utilities.