Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix command spawning when spaces occur in the path #520

Merged
merged 7 commits into from
Dec 17, 2017

Conversation

mvz
Copy link
Contributor

@mvz mvz commented Nov 28, 2017

Summary

There was a bug in how ChildProcess.build was called. This PR fixes this.

Details

Calling #to_a was called on UnixCommandString representing the executable, splitting the name unnecessarily.

Motivation and Context

See #490.

How Has This Been Tested?

A spec was added for this. This still needs to be tested on Windows.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • I've added tests for my code

@mvz
Copy link
Contributor Author

mvz commented Nov 28, 2017

This may need a slightly diffferent approach to not break on Windows.

Copy link
Contributor

@olleolleolle olleolleolle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!

@mvz
Copy link
Contributor Author

mvz commented Nov 29, 2017

This is ready for review.

@mvz
Copy link
Contributor Author

mvz commented Dec 16, 2017

@olleolleolle ok to merge?

Copy link
Contributor

@olleolleolle olleolleolle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I asked a question about the SimpleDelegator but other than that, I’m very pleased with the readability of this change.

@@ -11,13 +11,18 @@ module Platforms
# @private
class WindowsCommandString < SimpleDelegator
def initialize(cmd)
__setobj__ format('%s /c "%s"', Aruba.platform.which('cmd.exe'), cmd)
__setobj__ cmd
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the default right? No explicit need to implement the constructor?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may be right. I'll take a look.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it is no longer needed. I removed it.

@mvz mvz merged commit 02db24d into master Dec 17, 2017
@mvz mvz deleted the issue-490-fix-command-spawning branch December 17, 2017 17:28
@mvz mvz mentioned this pull request Jan 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants