Skip to content

Commit

Permalink
Fix commit issues on missing /dev/tty
Browse files Browse the repository at this point in the history
This fixes an issue encountered during committing on WSL2 with PHPStorm. The message was:
.git/hooks/prepare-commit-msg: 2: cannot open /dev/tty: No such device or address
  • Loading branch information
hoogi91 committed Oct 16, 2023
1 parent cd09c24 commit 8252cc3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Hook/Template/Docker.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ public function getCode(string $hook): string
$path2Config = $this->pathInfo->getConfigPath();
$config = $path2Config !== CH::CONFIG ? ' --configuration=' . escapeshellarg($path2Config) : '';
$bootstrap = !empty($this->config->getBootstrap()) ? ' --bootstrap=' . $this->config->getBootstrap() : '';
$tty = Hooks::allowsUserInput($hook) ? 'exec < /dev/tty' : '';
$tty = Hooks::allowsUserInput($hook)
? "if sh -c \": >/dev/tty\" >/dev/null 2>/dev/null; then\n\texec < /dev/tty\nfi"
: '';

$lines = [
'#!/bin/sh',
Expand Down

0 comments on commit 8252cc3

Please sign in to comment.