Skip to content

Commit be8c7e6

Browse files
gloursndeloof
authored andcommitted
make CTRL+Z a no-op operation on Windows
Signed-off-by: Guillaume Lours <[email protected]>
1 parent 27f59d7 commit be8c7e6

File tree

3 files changed

+51
-1
lines changed

3 files changed

+51
-1
lines changed

cmd/formatter/shortcut.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ func (lk *LogKeyboard) HandleKeyEvents(ctx context.Context, event keyboard.KeyEv
322322
// will notify main thread to kill and will handle gracefully
323323
lk.signalChannel <- syscall.SIGINT
324324
case keyboard.KeyCtrlZ:
325-
_ = syscall.Kill(0, syscall.SIGSTOP)
325+
handleCtrlZ()
326326
case keyboard.KeyEnter:
327327
newLine()
328328
lk.printNavigationMenu()

cmd/formatter/shortcut_unix.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
//go:build !windows
2+
3+
/*
4+
Copyright 2024 Docker Compose CLI authors
5+
6+
Licensed under the Apache License, Version 2.0 (the "License");
7+
you may not use this file except in compliance with the License.
8+
You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing, software
13+
distributed under the License is distributed on an "AS IS" BASIS,
14+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
See the License for the specific language governing permissions and
16+
limitations under the License.
17+
*/
18+
19+
package formatter
20+
21+
import "syscall"
22+
23+
func handleCtrlZ() {
24+
_ = syscall.Kill(0, syscall.SIGSTOP)
25+
}

cmd/formatter/shortcut_windows.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
//go:build windows
2+
3+
/*
4+
Copyright 2024 Docker Compose CLI authors
5+
6+
Licensed under the Apache License, Version 2.0 (the "License");
7+
you may not use this file except in compliance with the License.
8+
You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing, software
13+
distributed under the License is distributed on an "AS IS" BASIS,
14+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
See the License for the specific language governing permissions and
16+
limitations under the License.
17+
*/
18+
19+
package formatter
20+
21+
// handleCtrlZ is a no-op on Windows as SIGSTOP is not supported
22+
func handleCtrlZ() {
23+
// Windows doesn't support SIGSTOP/SIGCONT signals
24+
// Ctrl+Z behavior is handled differently by the Windows terminal
25+
}

0 commit comments

Comments
 (0)