@@ -351,22 +351,7 @@ func (d *Devbox) EnvExports(ctx context.Context, opts devopt.EnvExportsOpts) (st
351
351
var envs map [string ]string
352
352
var err error
353
353
354
- if opts .DontRecomputeEnvironment {
355
- upToDate , _ := d .lockfile .IsUpToDateAndInstalled (isFishShell ())
356
- if ! upToDate {
357
- ux .FHidableWarning (
358
- ctx ,
359
- d .stderr ,
360
- StateOutOfDateMessage ,
361
- d .refreshAliasOrCommand (),
362
- )
363
- }
364
-
365
- envs , err = d .computeEnv (ctx , true /*usePrintDevEnvCache*/ , opts .EnvOptions )
366
- } else {
367
- envs , err = d .ensureStateIsUpToDateAndComputeEnv (ctx , opts .EnvOptions )
368
- }
369
-
354
+ envs , err = d .ensureStateIsUpToDateAndComputeEnv (ctx , opts .EnvOptions )
370
355
if err != nil {
371
356
return "" , err
372
357
}
@@ -819,23 +804,35 @@ func (d *Devbox) ensureStateIsUpToDateAndComputeEnv(
819
804
) (map [string ]string , error ) {
820
805
defer debug .FunctionTimer ().End ()
821
806
822
- // When ensureStateIsUpToDate is called with ensure=true, it always
823
- // returns early if the lockfile is up to date. So we don't need to check here
824
- if err := d . ensureStateIsUpToDate ( ctx , ensure ); isConnectionError ( err ) {
825
- if ! fileutil . Exists ( d . nixPrintDevEnvCachePath ()) {
826
- ux . Ferrorf (
807
+ if ! envOpts . RecomputeEnv {
808
+ upToDate , _ := d . lockfile . IsUpToDateAndInstalled ( isFishShell ())
809
+ if ! upToDate {
810
+ ux . FHidableWarning (
811
+ ctx ,
827
812
d .stderr ,
828
- "Error connecting to the internet and no cached environment found. Aborting.\n " ,
813
+ StateOutOfDateMessage ,
814
+ d .refreshAliasOrCommand (),
829
815
)
816
+ }
817
+ } else {
818
+ // When ensureStateIsUpToDate is called with ensure=true, it always
819
+ // returns early if the lockfile is up to date. So we don't need to check here
820
+ if err := d .ensureStateIsUpToDate (ctx , ensure ); isConnectionError (err ) {
821
+ if ! fileutil .Exists (d .nixPrintDevEnvCachePath ()) {
822
+ ux .Ferrorf (
823
+ d .stderr ,
824
+ "Error connecting to the internet and no cached environment found. Aborting.\n " ,
825
+ )
826
+ return nil , err
827
+ }
828
+ ux .Fwarningf (
829
+ d .stderr ,
830
+ "Error connecting to the internet. Will attempt to use cached environment.\n " ,
831
+ )
832
+ } else if err != nil {
833
+ // Some other non connection error, just return it.
830
834
return nil , err
831
835
}
832
- ux .Fwarningf (
833
- d .stderr ,
834
- "Error connecting to the internet. Will attempt to use cached environment.\n " ,
835
- )
836
- } else if err != nil {
837
- // Some other non connection error, just return it.
838
- return nil , err
839
836
}
840
837
841
838
// Since ensureStateIsUpToDate calls computeEnv when not up do date,
0 commit comments