just icon indicating copy to clipboard operation
just copied to clipboard

Improve error message if `working-directory` does not exist

Open nyurik opened this issue 1 year ago • 3 comments

For justfiles that override working-directory value, if the dir does not exist, just gives a rather criptic message:

set working-directory := 'missing'

[no-cd]
bar:
  pwd   # this one will work fine

foo:
  pwd   # this one will not even start if 'missing' dir is missing
error: Recipe ... could not be run because just could not find 
the shell: No such file or directory (os error 2)

nyurik avatar Aug 02 '24 19:08 nyurik

I think the best way to fix this is, when running a command, if it returns an error and that error is file not found, check if the working directory exists and if it does not, transform the error into a more specific error about the working directory not existing.

casey avatar Aug 02 '24 19:08 casey

Was hit by this yesterday and the current error message was definitely confusing.

tritao avatar Aug 12 '24 11:08 tritao

The same problem would happen if the working directory was a file or couldn't be changed to due to lack of permissions, so I tackled all possibilities at once.

artm avatar Aug 24 '24 11:08 artm