Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Working directory for cmdrunner? #1293

Closed
divan opened this issue Aug 14, 2022 · 2 comments
Closed

Working directory for cmdrunner? #1293

divan opened this issue Aug 14, 2022 · 2 comments

Comments

@divan
Copy link

divan commented Aug 14, 2022

Hey, is there a way to specify the working dir for command run by cmdrunner module?

My use case is showing some stats of outdated dependencies in a few working dirs with source code. Most tools that can analyze dependencies must be run from the project's directory. Am I overlooking something or there is no way to specify working dir at the moment?

@Seanstoppable
Copy link
Collaborator

That is an interesting thought.
A few things I can think of:

  1. Wrap it in a shell script and have the shell script handle going to the appropriate directory before calling the command.

  2. Have cmdrunner automatically parse a path if present and go to the directory and execute the command

  3. Include a working_dir config option that cmdrunner will go to the directory and execute the command

  4. Should be doable now

  5. Seems maybe too much magic/I definately pause to think about unintended side effects

  6. Seems straightforward, intentional by the person setting up the command and backwards compatible.

@divan
Copy link
Author

divan commented Aug 20, 2022

Right, I think specifying working_dir is pretty common for running external commands. Systemd has it, Go's os.Cmd type has it, cron, well, doesn't have, but it doesn't have any configuration for commands at all.

Re 2, I think no need to automatically parsing path - it's either default, or user specified. That'll work.

Seanstoppable added a commit to Seanstoppable/wtf that referenced this issue Aug 22, 2022
Seanstoppable added a commit to Seanstoppable/wtf that referenced this issue Aug 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants