Skip to content

Commit

Permalink
Kernel.system should set $? to Status, not to Fixnum
Browse files Browse the repository at this point in the history
  • Loading branch information
Shri Borde committed May 26, 2009
1 parent d716e75 commit 73e175b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
Expand Up @@ -44,7 +44,8 @@

before :each do
ENV['TEST_SH_EXPANSION'] = 'foo'
@shell_var = platform_is(:windows) ? '%TEST_SH_EXPANSION%' : '$TEST_SH_EXPANSION'
@shell_var = '$TEST_SH_EXPANSION'
platform_is(:windows) do @shell_var = '%TEST_SH_EXPANSION%' end
@helper_script = KernelSpecs.helper_script
end

Expand All @@ -57,4 +58,13 @@
result = system("ruby", @helper_script, @shell_var, "foo")
result.should be_false
end

it "sets $?" do
system("cd")
$?.exitstatus.should == 0

system("cd non-existent")
$?.exitstatus.should_not == 0
end

end
Expand Up @@ -209,7 +209,7 @@ public static class KernelOps {
[RubyMethod("exec", RubyMethodAttributes.PublicSingleton, BuildConfig = "!SILVERLIGHT")]
public static void Execute(RubyContext/*!*/ context, object self, [DefaultProtocol, NotNull]MutableString/*!*/ command) {
Process p = ExecuteCommandInShell(context, command);
context.ChildProcessExitStatus = p.ExitCode;
context.ChildProcessExitStatus = new RubyProcess.Status(p);
Exit(self, p.ExitCode);
}

Expand All @@ -218,15 +218,15 @@ public static class KernelOps {
public static void Execute(RubyContext/*!*/ context, object self, [DefaultProtocol, NotNull]MutableString/*!*/ command,
[DefaultProtocol, NotNull, NotNullItems]params MutableString[]/*!*/ args) {
Process p = ExecuteCommand(command, args);
context.ChildProcessExitStatus = p.ExitCode;
context.ChildProcessExitStatus = new RubyProcess.Status(p);
Exit(self, p.ExitCode);
}

[RubyMethod("system", RubyMethodAttributes.PrivateInstance, BuildConfig = "!SILVERLIGHT")]
[RubyMethod("system", RubyMethodAttributes.PublicSingleton, BuildConfig = "!SILVERLIGHT")]
public static bool System(RubyContext/*!*/ context, object self, [DefaultProtocol, NotNull]MutableString/*!*/ command) {
Process p = ExecuteCommandInShell(context, command);
context.ChildProcessExitStatus = p.ExitCode;
context.ChildProcessExitStatus = new RubyProcess.Status(p);
return p.ExitCode == 0;
}

Expand All @@ -235,7 +235,7 @@ public static class KernelOps {
public static bool System(RubyContext/*!*/ context, object self, [DefaultProtocol, NotNull]MutableString/*!*/ command,
[DefaultProtocol, NotNull, NotNullItems]params MutableString/*!*/[]/*!*/ args) {
Process p = ExecuteCommand(command, args);
context.ChildProcessExitStatus = p.ExitCode;
context.ChildProcessExitStatus = new RubyProcess.Status(p);
return p.ExitCode == 0;
}
#endif
Expand Down
9 changes: 3 additions & 6 deletions Merlin/Main/Languages/Ruby/Scripts/RakeTests.rb
Expand Up @@ -26,16 +26,12 @@ def test_cloned_items_stay_frozen() end
end

class TestFileUtils
# Most of these failures are because of http://ironruby.codeplex.com/WorkItem/View.aspx?WorkItemId=1184 resulting in these errors
# NoMethodError: undefined method `exitstatus' for 123:Fixnum
# Most of these failures are because of http://ironruby.codeplex.com/WorkItem/View.aspx?WorkItemId=1184 resulting in this error:
# NoMethodError: private method `safe_ln' called for #<TestFileUtils::BadLink:0x0002f72 @failure_class=NotImplementedError>
def test_ruby() end
def test_safe_ln_failover_to_cp_on_not_implemented_error() end
def test_safe_ln_failover_to_cp_on_standard_error() end
def test_safe_ln_fails_on_script_error() end
def test_sh_failure() end
def test_sh_multiple_arguments() end
def test_sh_special_handling() end
end

class TestPathMapExplode
Expand All @@ -49,6 +45,7 @@ def test_each_dir_parent() end
end

class TestTask
# This failure does not happen with a later version of Rake. Might be a test issue
# This failure does not happen with a later version (afer 0.8.4) of Rake tests with the same version (0.8.4) of the Rake gem.
# So it might be a test issue
def test_investigation_output() end
end

0 comments on commit 73e175b

Please sign in to comment.