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

LoadError changes current working directory in CLI #4150

Closed
macumber opened this issue Nov 26, 2020 · 4 comments
Closed

LoadError changes current working directory in CLI #4150

macumber opened this issue Nov 26, 2020 · 4 comments

Comments

@macumber
Copy link
Contributor

Issue overview

Loading a measure with a rescued LoadError in a workflow causes the current working directory to change.

Current Behavior

Loading a measure which tries to load a gem but then falls back to load a resource file results in the current working directory changing. This causes problems if the measure attempts to write a file.

Expected Behavior

Rescuing the LoadError should not change the current working directory.

Steps to Reproduce

/c/openstudio-3.1.0/bin/openstudio.exe run -m -w workflow.osw fails
/c/openstudio-3.0.0/bin/openstudio.exe run -m -w workflow.osw fails
/c/openstudio-2.9.1/bin/openstudio.exe run -m -w workflow.osw succeeds

Some additional details about your environment for this issue (if relevant):

  • Platform (Operating system, version): Windows 10
  • Version of OpenStudio (if using an intermediate build, include SHA): 3.1.0 and 3.0.0
@macumber macumber added the Triage Issue needs to be assessed and labeled, further information on reported might be needed label Nov 26, 2020
@macumber
Copy link
Contributor Author

macumber commented Nov 26, 2020

Workflow and measure to reproduce the issue:

bug.zip

@tijcolem tijcolem added severity - Normal Bug component - CLI and removed Triage Issue needs to be assessed and labeled, further information on reported might be needed labels Dec 8, 2020
@tijcolem tijcolem added this to the OpenStudio SDK 3.2.0 milestone Dec 8, 2020
@tijcolem
Copy link
Collaborator

tijcolem commented Mar 5, 2021

Thanks for the report on this @macumber. I am looking into this now.

Looks like this is happening in the workflow gem. Possibly in this step here.
https://github.com/NREL/OpenStudio-workflow-gem/blob/develop/lib/openstudio/workflow/run.rb#L290

tijcolem added a commit to NREL/OpenStudio-workflow-gem that referenced this issue Mar 12, 2021
@tijcolem
Copy link
Collaborator

fix for this is here. NREL/OpenStudio-workflow-gem#130
I think this is happening in load.c and related to how it's working within the CLI. Using load in pure ruby doesn't change cwd.

@tijcolem
Copy link
Collaborator

fixed via NREL/OpenStudio-workflow-gem#130

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

2 participants