Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion pre_commit/commands/install_uninstall.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import io
import os.path
import pipes
import sys

from pre_commit import output
Expand Down Expand Up @@ -68,7 +69,7 @@ def install(

skip_on_missing_conf = 'true' if skip_on_missing_conf else 'false'
contents = io.open(resource_filename('hook-tmpl')).read().format(
sys_executable=sys.executable,
sys_executable=pipes.quote(sys.executable),
hook_type=hook_type,
hook_specific=hook_specific_contents,
config_file=runner.config_file,
Expand Down
2 changes: 1 addition & 1 deletion pre_commit/resources/hook-tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ popd > /dev/null
retv=0
args=""

ENV_PYTHON='{sys_executable}'
ENV_PYTHON={sys_executable}
SKIP_ON_MISSING_CONF={skip_on_missing_conf}

which pre-commit >& /dev/null
Expand Down
5 changes: 3 additions & 2 deletions tests/commands/install_uninstall_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import io
import os.path
import pipes
import re
import shutil
import subprocess
Expand Down Expand Up @@ -54,7 +55,7 @@ def test_install_pre_commit(tempdir_factory):
pre_commit_contents = io.open(runner.pre_commit_path).read()
pre_commit_script = resource_filename('hook-tmpl')
expected_contents = io.open(pre_commit_script).read().format(
sys_executable=sys.executable,
sys_executable=pipes.quote(sys.executable),
hook_type='pre-commit',
hook_specific='',
config_file=runner.config_file,
Expand All @@ -70,7 +71,7 @@ def test_install_pre_commit(tempdir_factory):
pre_push_tmpl = resource_filename('pre-push-tmpl')
pre_push_template_contents = io.open(pre_push_tmpl).read()
expected_contents = io.open(pre_commit_script).read().format(
sys_executable=sys.executable,
sys_executable=pipes.quote(sys.executable),
hook_type='pre-push',
hook_specific=pre_push_template_contents,
config_file=runner.config_file,
Expand Down