Skip to content

Commit

Permalink
confirm saving config when rocker exited with error
Browse files Browse the repository at this point in the history
  • Loading branch information
muritane committed Feb 5, 2024
1 parent ece15bf commit ea09914
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions rtwcli/rtw_cmds/rtw_cmds/workspace/verbs.py
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,7 @@ def main(self, *, args):

# docker handling: create docker workspace
final_image_name = None
has_rocker_error = False
if args.docker:
print("Creating docker workspace")

Expand Down Expand Up @@ -921,6 +922,9 @@ def main(self, *, args):
. ~/.ros_team_ws_rc
fi
# Stogl Robotics custom setup for nice colors and showing ROS workspace
. {args.rtw_path}/scripts/configuration/terminal_coloring.bash
# automatically use the main workspace
rtw workspace use {ws_name}
"""
Expand Down Expand Up @@ -990,8 +994,15 @@ def main(self, *, args):
f"with command '{rocker_cmd_str}'"
)

if not run_command(rocker_cmd):
print(f"Failed to create final image '{final_image_name}' with rocker.")
has_rocker_error = not run_command(rocker_cmd)

# ask the user to still save ws config even if there was a rocker error
if has_rocker_error:
still_save_config = questionary.confirm(
"There was an error with rocker. Do you want to save the workspace config?"
).ask()
if not still_save_config:
print("Not saving the workspace config.")
return

# create local upstream workspace
Expand Down

0 comments on commit ea09914

Please sign in to comment.