robvanderleek / mudslide

Send WhatsApp messages from the command-line
ISC License
120 stars 12 forks source link

Fails to run within bash script #60

Closed ant-thomas closed 8 months ago

ant-thomas commented 8 months ago

I'm trying to use mudslide within a bash script that is scheduled to run via crontab but it fails. Using the pre-compiled release on x64 platform. When testing manually I get this error... I feel like it'll probably be a simple one to resolve - any ideas?

node:internal/bootstrap/switches/does_own_process_state:126
    cachedCwd = rawMethods.cwd();
                           ^

Error: ENOENT: no such file or directory, uv_cwd
    at process.wrappedCwd (node:internal/bootstrap/switches/does_own_process_state:126:28)
    at process.cwd (/snapshot/dist-ncc/index.js:114621:19)
    at node:path:1082:24
    at Object.resolve (node:path:1096:39)
    at Function.sync (/snapshot/dist-ncc/index.js:123041:17)
    at Function.sync (/snapshot/dist-ncc/index.js:122984:20)
    at Signale.get packageConfiguration [as packageConfiguration] (/snapshot/dist-ncc/index.js:131450:20)
    at new Signale (/snapshot/dist-ncc/index.js:131389:39)
    at Object.528 (/snapshot/dist-ncc/index.js:129436:32)
    at __nccwpck_require__ (/snapshot/dist-ncc/index.js:153161:43) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'uv_cwd'
}
robvanderleek commented 8 months ago

Hi @ant-thomas

Sorry to hear the binary does not work for you.

Can you give an example of how you're using it in the script? Does it also fail when you're running the script yourself in the shell, or only when it runs in cron?

ant-thomas commented 8 months ago

Sorry, I should have added much more detail.

I've now fixed it.

The script was in a working directory that gets deleted and then mudslide was trying to run. Looks like it didn't work due to the script being in a directory that no longer existed. Amended the script to move to a different directory before running mudslide and it now works as expected.