Commit bce649bd authored by intrigeri's avatar intrigeri
Browse files

Rubocop: fix Style/SpecialGlobalVars offenses

Changes generated with:

`rubocop --only Style/SpecialGlobalVars --auto-correct`
parent 6024e0f7
......@@ -714,13 +714,6 @@ Style/Semicolon:
Exclude:
- 'features/step_definitions/apt.rb'
# Offense count: 18
# Cop supports --auto-correct.
# Configuration parameters: .
# SupportedStyles: use_perl_names, use_english_names
Style/SpecialGlobalVars:
EnforcedStyle: use_perl_names
# Offense count: 29
# Cop supports --auto-correct.
Style/StderrPuts:
......
......@@ -74,9 +74,9 @@ end
def run_command(*args)
Process.wait Kernel.spawn(*args)
if $?.exitstatus != 0
if $CHILD_STATUS.exitstatus != 0
raise CommandError.new("command #{args} failed with exit status " +
"%{status}", status: $?.exitstatus)
"%{status}", status: $CHILD_STATUS.exitstatus)
end
end
......
......@@ -13,7 +13,7 @@ include Test::Unit::Assertions
# The Ruby Git module we use needs the Git root directory, and this
# prevents it from being able to run the command below.
GIT_DIR = `git rev-parse --show-toplevel`.chomp
assert_equal(0, $?.exitstatus)
assert_equal(0, $CHILD_STATUS.exitstatus)
DEFAULT_RELATIONSHIP_FILE = "#{GIT_DIR}/doc-source-relationships.yml"
class Object
......@@ -160,7 +160,7 @@ def find_impacted_docs(impact_map,
git_cmd_wiki_files = "git ls-tree -r --full-tree " +
"--name-only #{new_commit} -- wiki/src"
doc_pages = `#{git_cmd_wiki_files}`.chomp.split("\n")
assert_equal(0, $?.exitstatus, "Error: `git ls-tree` failed")
assert_equal(0, $CHILD_STATUS.exitstatus, "Error: `git ls-tree` failed")
old_packages = old_manifest.keys
new_packages = new_manifest.keys
......
......@@ -13,7 +13,7 @@ Encoding.default_internal = Encoding::UTF_8
GIT_DIR = `git rev-parse --show-toplevel`
assert_equal(
0, $?.exitstatus,
0, $CHILD_STATUS.exitstatus,
"Failed to find Tails' Git root; this command must be run " +
"inside Tails Git repo"
)
......
......@@ -35,7 +35,7 @@ end
Given /^the last version mentioned in debian\/changelog is ([[:alnum:]~.]+)$/ do |version|
last = `dpkg-parsechangelog | awk '/^Version: / { print $2 }'`.strip
raise StandardError.new('dpkg-parsechangelog failed.') if $? != 0
raise StandardError.new('dpkg-parsechangelog failed.') if $CHILD_STATUS != 0
if last != version
fatal_system "debchange -v '#{version}' 'New upstream release'"
......@@ -98,12 +98,12 @@ end
When /^I successfully run "?([[:alnum:] -]+)"?$/ do |command|
@output = `#{File.expand_path("../../../auto/scripts/#{command}", __FILE__)}`
raise StandardError.new("#{command} failed. Exit code: #{$?}") if $? != 0
raise StandardError.new("#{command} failed. Exit code: #{$CHILD_STATUS}") if $CHILD_STATUS != 0
end
When /^I run "?([[:alnum:] -]+)"?$/ do |command|
@output = `#{File.expand_path("../../../auto/scripts/#{command}", __FILE__)}`
@exit_code = $?.exitstatus
@exit_code = $CHILD_STATUS.exitstatus
end
Then /^I should see the ['"]?([[:alnum:].-]+)['"]? suite$/ do |suite|
......
......@@ -72,7 +72,7 @@ def create_veracrypt_volume(type, with_keyfile)
ensure
Process.wait pid
end
($?.exitstatus == 0) || raise("#{tcplay_create_cmd} exited with #{$?.exitstatus}")
($CHILD_STATUS.exitstatus == 0) || raise("#{tcplay_create_cmd} exited with #{$CHILD_STATUS.exitstatus}")
end
tcplay_map_cmd = "tcplay --map=veracrypt --device='#{loop_dev}'"
tcplay_map_cmd += " --keyfile='#{keyfile}'" if @veracrypt_needs_keyfile
......@@ -87,7 +87,7 @@ def create_veracrypt_volume(type, with_keyfile)
ensure
Process.wait pid
end
($?.exitstatus == 0) || raise("#{tcplay_map_cmd} exited with #{$?.exitstatus}")
($CHILD_STATUS.exitstatus == 0) || raise("#{tcplay_map_cmd} exited with #{$CHILD_STATUS.exitstatus}")
end
fatal_system "mkfs.vfat '/dev/mapper/veracrypt' >/dev/null"
Dir.mktmpdir('veracrypt-mountpoint', $config["TMPDIR"]) do |mountpoint|
......
......@@ -11,7 +11,7 @@ Encoding.default_internal = Encoding::UTF_8
def fatal_system(str, *args)
unless system(str, *args)
raise StandardError.new("Command exited with #{$?}")
raise StandardError.new("Command exited with #{$CHILD_STATUS}")
end
end
......
......@@ -9,7 +9,7 @@ class Display
"-name", "#{@domain} (1) - Virt Viewer",
:err => ["/dev/null", "w"],])
Process.wait(p.pid)
$?.success?
$CHILD_STATUS.success?
end
def start
......@@ -47,7 +47,7 @@ class Display
def screenshot(target)
FileUtils.rm_f(target)
popen_wait(['import', '-quality', '100%', '-window', 'root', target])
assert($?.success?)
assert($CHILD_STATUS.success?)
assert(File.exist?(target))
end
end
......@@ -241,7 +241,7 @@ def cmd_helper(cmd, env = {})
IO.popen(env, cmd) do |p|
out = p.readlines.join("\n")
Process.wait(p.pid)
ret = $?
ret = $CHILD_STATUS
assert_equal(0, ret, "Command failed (returned #{ret}): #{cmd}:\n#{out}")
return out
end
......
......@@ -23,7 +23,7 @@ module OpenCV
err: [:child, :out]
)
out = p.readlines.join("\n")
case $?.exitstatus
case $CHILD_STATUS.exitstatus
when 0
return out.chomp.split.map { |s| s.to_i }
when 1
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment