Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8426093
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T04:27:13+00:00 2026-06-10T04:27:13+00:00

I am using Git on Windows and trying to include unit testing in the

  • 0

I am using Git on Windows and trying to include unit testing in the workflow. If the commit message contain a keyword. The commit-msg hook will trigger Powershell command to run some Nunit tests.

This is my ruby code in the hook

#!/usr/bin/env ruby
message_file = ARGV[0]
message = File.read(message_file)

puts "The commit message is " + message

$regex = /(#runtest)/

if $regex.match(message)
    exec 'powershell.exe -ExecutionPolicy RemoteSigned -Command {RunNunitTestCase}'
end

However when I commit a changes, the result is like below. The exec line was run but do nothing.

PS D:\testfolder> git commit -am '#runtest'
The commit message is #runtest
[authorupdate b14878d] 123
 1 files changed, 1 insertions(+), 0 deletions(-)

I am new to ruby and powershell. Feel free to comment if this workflow is feasible or you have a better approach.

Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T04:27:15+00:00Added an answer on June 10, 2026 at 4:27 am

    The curly bracket needs to be escaped.

    exec "powershell.exe -ExecutionPolicy RemoteSigned -Command & \{RunNunitTestCase\}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to get a git commit email hook running using Git on Windows.
I'm trying to run a pull request from git using PHP's exec on windows
I get the following message while trying to ./configure opa_v2980 using Cygwin in Windows
I'm using msys Git for source control on a Windows machine and I'm trying
I'm using remote git repository. I successfully commit my files and now I'm trying
I' using windows, git bash prompt I'm trying to use the git archive command
I'm using Git Bash on Windows 7. When I run git diff , I
I'm using git (in fact, msysgit) 1.6.4 on Windows. Most of the time I'm
I have just installed Git For Windows , and created my SSH key using
I'm relearning UNIX commands to use git on windows using MINGW32. When I launch

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.