Forever changes current working directory when script path is absolute
See original GitHub issueIf 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:
- Created 11 years ago
- Comments:20 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This solved my problem, maybe it will be useful for someone:
forever start --sourceDir /var/www/html/sitedir scriptname.js
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.