RejectedSoftware Forums

Sign up

dub run and working directories

dub run can currently take a package name that was installed with dub fetch. However, it runs with the current working directory set to ~/.dub/packages/... and I'd like it to run in the directory I launch dub run from. Is there any way to do this? Thanks in advance,

Atila

Re: dub run and working directories

On Thu, 06 Mar 2014 16:19:24 GMT, Atila Neves wrote:

dub run can currently take a package name that was installed with dub fetch. However, it runs with the current working directory set to ~/.dub/packages/... and I'd like it to run in the directory I launch dub run from. Is there any way to do this? Thanks in advance,

Atila

Oh, and as a side-effect of it running in the wrong directory, it leaves behind traces such as the binary it built and the .dub directory which cause a subsequent call to "dub fetch" to fail because of the untracked files there.

dub fetch dtest
dub run dtest #runs in the wrong dir and doesn't work as expected
dub fetch dtest #fails

Re: dub run and working directories

On Thu, 06 Mar 2014 17:20:47 GMT, Atila Neves wrote:

On Thu, 06 Mar 2014 16:19:24 GMT, Atila Neves wrote:

dub run can currently take a package name that was installed with dub fetch. However, it runs with the current working directory set to ~/.dub/packages/... and I'd like it to run in the directory I launch dub run from. Is there any way to do this? Thanks in advance,

Atila

I think we should change the behavior to run in the CWD by default and only in a different directory if an explicit "workingDirectory" has been specified. Maybe also with additional --run-in-package-dir and --run-in-cwd switches to override the default behavior. Added a ticket: #272

Oh, and as a side-effect of it running in the wrong directory, it leaves behind traces such as the binary it built and the .dub directory which cause a subsequent call to "dub fetch" to fail because of the untracked files there.

dub fetch dtest
dub run dtest #runs in the wrong dir and doesn't work as expected
dub fetch dtest #fails

This definitely needs to be improved in at least two ways:

  1. Treat the output binary as a known file and simply delete it
  2. If there are any other files (e.g. log files) left behind, mention to use --force-remove or to delete the folder manually

Re: dub run and working directories

On Mon, 10 Mar 2014 16:39:26 GMT, Sönke Ludwig wrote:

On Thu, 06 Mar 2014 17:20:47 GMT, Atila Neves wrote:

On Thu, 06 Mar 2014 16:19:24 GMT, Atila Neves wrote:

dub run can currently take a package name that was installed with dub fetch. However, it runs with the current working directory set to ~/.dub/packages/... and I'd like it to run in the directory I launch dub run from. Is there any way to do this? Thanks in advance,

Atila

I think we should change the behavior to run in the CWD by default and only in a different directory if an explicit "workingDirectory" has been specified. Maybe also with additional --run-in-package-dir and --run-in-cwd switches to override the default behavior. Added a ticket: #272

Oh, and as a side-effect of it running in the wrong directory, it leaves behind traces such as the binary it built and the .dub directory which cause a subsequent call to "dub fetch" to fail because of the untracked files there.

dub fetch dtest
dub run dtest #runs in the wrong dir and doesn't work as expected
dub fetch dtest #fails

This definitely needs to be improved in at least two ways:

  1. Treat the output binary as a known file and simply delete it
  2. If there are any other files (e.g. log files) left behind, mention to use --force-remove or to delete the folder manually

Cool, thanks for looking into it.

Atila