Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@wilfredallyn
Copy link
Contributor

Part of #36: add redis process to devenv.nix

Run these commands to verify redis working. redis process should appear.

devenv shell
devenv up

You can also open another terminal and run devenv shell. It will show a list of running processes. Then you can run redis-cli commands

  • redis-cli ping
  • redis-cli info server
  • redis-cli set test "hello world" && redis-cli get test

@vnprc
Copy link
Owner

vnprc commented Apr 10, 2025

Looks good except I am not seeing the log file. Troubleshooting it now.

Copy link
Owner

@vnprc vnprc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you update withLogging so that all processes log to console and to a log file?

My LLM suggests this change. I haven't tested it so it's probably broken but this should get you started.

✅ Updated withLogging that works with forking processes:

withLogging = command: logFile:
  ''
    mkdir -p ${config.devenv.root}/logs
    ${command} 2>&1 | stdbuf -oL tee -a ${config.devenv.root}/logs/${logFile}
  '';

Key changes:

No bash -c

Runs the command directly, piping into tee

stdbuf is now only on tee, where it’s effective even after fork

devenv.nix Outdated

# https://devenv.sh/processes/
processes = {
redis = {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently redis forks on startup and this doesn't play nicely with the bash -c command in the withLogging function.

@wilfredallyn
Copy link
Contributor Author

I revised withLogging and also the redis process command. The logging is now working. Thanks for the help

@wilfredallyn wilfredallyn requested a review from vnprc April 11, 2025 11:32
@vnprc
Copy link
Owner

vnprc commented Apr 11, 2025

Excellent!

@vnprc vnprc merged commit 0dc72d5 into vnprc:master Apr 11, 2025
@wilfredallyn wilfredallyn deleted the redis branch April 11, 2025 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants