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

Add --cwd parameter to stack exec #3264

Closed
phadej opened this issue Jul 13, 2017 · 4 comments
Closed

Add --cwd parameter to stack exec #3264

phadej opened this issue Jul 13, 2017 · 4 comments

Comments

@phadej
Copy link
Collaborator

phadej commented Jul 13, 2017

--cwd                    Change current directory before executing

I'm happy to make a PR, this shouldn't be too hard to do.

My motivation is running benchmarks in aeson

@snoyberg
Copy link
Contributor

I don't have a problem with such an addition, PR definitely welcome, but I'm curious: why isn't using cd an option in this case?

@phadej
Copy link
Collaborator Author

phadej commented Jul 17, 2017

@snoyberg the difference isn't big, but IMHO the first variant is hacky (note ../)

aeson$ (cd benchmarks && STACK_YAML=../stack-bench.yaml stack exec -- aeson-benchmark-typed encodeGeneric/direct/twitter100 +RTS -s)

vs

aeson$ STACK_YAML=stack-bench.yaml stack exec --cwd benchmarks -- aeson-benchmark-typed encodeGeneric/direct/twitter100 +RTS -s

@decentral1se decentral1se added this to the P3: Optional milestone Aug 6, 2017
khanage pushed a commit to khanage/stack that referenced this issue Oct 15, 2017
Welcome for any suggestions as to better methods to use/docs to update.
@khanage
Copy link
Contributor

khanage commented Oct 15, 2017

Hey I just implemented this - works fine from the console. I'm happy to make any improvements, but it is pretty straight forward :)

This is run from the stack directory:

# khan at Loki in ~/Dropbox/hask/stack on git:3264-add-cwd-to-exec ● [23:26:34]
→ stack exec -- stack -- exec --cwd dist ls
setup		store-versioned

# khan at Loki in ~/Dropbox/hask/stack on git:3264-add-cwd-to-exec ● [23:26:41]
→ stack exec -- stack -- exec ls
CONTRIBUTING.md		LICENSE			Setup.hs		appveyor.yml		dist			dot-dir-locals.el	mkdocs.yml		stack-nightly.yaml	stack.yaml
ChangeLog.md		README.md		TAGS			cabal.sandbox.config	doc			etc			src			stack.cabal		test

mgsloan added a commit that referenced this issue Oct 18, 2017
mgsloan added a commit that referenced this issue Oct 18, 2017
@mgsloan mgsloan closed this as completed Oct 18, 2017
tswelsh pushed a commit to tswelsh/stack that referenced this issue Nov 7, 2017
Welcome for any suggestions as to better methods to use/docs to update.
tswelsh pushed a commit to tswelsh/stack that referenced this issue Nov 7, 2017
@avanov
Copy link

avanov commented Oct 15, 2020

Why wasn't this flag propagated to stack test command?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants