Skip to content

Commit

Permalink
Print out error messages for debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefanni Brasil committed Apr 22, 2024
1 parent 17504cc commit 9b6dafb
Showing 1 changed file with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,23 @@ def setup
end

def successfully(command, silent = false)
silencer = if silent
"1>/dev/null"
redirection = if silent
"1>/dev/null 2>&1" # Redirect both stdout and stderr to /dev/null
else
""
"2>&1" # Merge stderr with stdout
end

return_value = system("#{command} #{silencer}")
# Execute the command with the specified redirection
output = `#{command} #{redirection}`

assert return_value
# Check the return status of the command
success = $?.success?

# Raise an error if the command execution was not successful
raise "Command '#{command}' failed with error: #{output}" unless success

# Return the combined output
output
end

def update_package_json
Expand Down Expand Up @@ -118,8 +126,8 @@ def test_installation
FileUtils.rm_rf("testapp")
generate_test_app_7 "testapp"
Dir.chdir("testapp") do
successfully "bundle install"
successfully "yarn add react react-dom @babel/preset-react"
successfully("bin/rails about")

FileUtils.rm_f("public/index.html")
install_superglue
Expand Down

0 comments on commit 9b6dafb

Please sign in to comment.