question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Forever changes current working directory when script path is absolute

See original GitHub issue

If I use:

forever start /opt/stagecoach/apps/example/deployments/2012-04-23-09-46-19/server.js

The current working directory is changed to / by forever before the script is run (verified with process.cwd()).

If I use:

forever start server.js

I do not see this problem, the current working directory is left alone.

I am not sure if the --sourceDir option is meant to help with this, but it does not appear to.

Thanks for an excellent process babysitter!

Issue Analytics

  • State:open
  • Created 11 years ago
  • Comments:20 (3 by maintainers)

github_iconTop GitHub Comments

7reactions
felipe-mulhbaiercommented, Apr 3, 2019

This solved my problem, maybe it will be useful for someone:

forever start --sourceDir /var/www/html/sitedir scriptname.js

1reaction
caomucommented, Sep 18, 2014

C:\Users\guorong841>C:\Users\guorong841\AppData\Roaming\npm\forever.cmd --minUpt ime 1000ms --spinSleepTime 1000ms D:\workspace\jee\activity\server.js error: Cannot start forever error: script C:\Users\guorong841\D:\workspace\jee\activity\server.js does not exist.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Forever changes current working directory when script path is ...
When forever is run from a script that references an absolute path, process.cwd() returns the script directory instead of the local directory.
Read more >
How can I set the current working directory to ... - Stack Overflow
The default behavior is that the current working directory in the script is that of the shell from which I run it, but...
Read more >
How do I shorten the current directory path shown on terminal?
Since bash 4, to shorten the depth of directory in command-line is done by using PROMPT_DIRTRIM in the .bashrc file.
Read more >
Change current folder - MATLAB cd - MathWorks
Use a relative path to change the current folder from C:\Program Files\MATLAB\R2017a back to C:\Program Files\MATLAB\R2017a\examples\matlab_featured . cd ...
Read more >
Kotlin Program to Get Current Working Directory - Programiz
We then change the relative path to absolute path using toAbsolutePath() . Since, it returns a Path object, we need to change it...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found