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 · 3 comments

Comments

Projects
None yet
5 participants
@phadej
Contributor

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

This comment has been minimized.

Contributor

snoyberg commented Jul 17, 2017

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

This comment has been minimized.

Contributor

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

@lwm lwm added this to the P3: Optional milestone Aug 6, 2017

khanage pushed a commit to khanage/stack that referenced this issue Oct 15, 2017

Khan Thompson
Implement commercialhaskell#3264 adding --cwd to exec
Welcome for any suggestions as to better methods to use/docs to update.
@khanage

This comment has been minimized.

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 Oct 18, 2017

tswelsh added a commit to tswelsh/stack that referenced this issue Nov 7, 2017

Implement commercialhaskell#3264 adding --cwd to exec
Welcome for any suggestions as to better methods to use/docs to update.

tswelsh added a commit to tswelsh/stack that referenced this issue Nov 7, 2017

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