@@ -39,13 +39,22 @@ func (r *RootCmd) update() *serpent.Command {
3939// updating. Simply performing a new start transition may not work if the
4040// template specifies ignore_changes.
4141if workspace .LatestBuild .Transition == codersdk .WorkspaceTransitionStart {
42- build ,err := stopWorkspace (inv ,client ,workspace ,bflags )
43- if err != nil {
44- return xerrors .Errorf ("stop workspace: %w" ,err )
45- }
46- // Wait for the stop to complete.
47- if err := cliui .WorkspaceBuild (inv .Context (),inv .Stdout ,client ,build .ID );err != nil {
48- return xerrors .Errorf ("wait for stop: %w" ,err )
42+ // It's polite to ask the user before stopping their workspace.
43+ cliui .Info (inv .Stdout ,"Your workspace is currently running. We recommend stopping it before proceeding." )
44+ if _ ,err := cliui .Prompt (inv , cliui.PromptOptions {
45+ Text :"Confirm stop workspace?" ,
46+ IsConfirm :true ,
47+ });err != nil {
48+ cliui .Warnf (inv .Stderr ,"Updating without stop." )
49+ }else {
50+ build ,err := stopWorkspace (inv ,client ,workspace ,bflags )
51+ if err != nil {
52+ return xerrors .Errorf ("stop workspace: %w" ,err )
53+ }
54+ // Wait for the stop to complete.
55+ if err := cliui .WorkspaceBuild (inv .Context (),inv .Stdout ,client ,build .ID );err != nil {
56+ return xerrors .Errorf ("wait for stop: %w" ,err )
57+ }
4958}
5059}
5160