Skip to content
This repository was archived by the owner on Jul 14, 2021. It is now read-only.

Add support for a Windows environment without true/false #240

Merged
merged 1 commit into from
Nov 20, 2014

Conversation

btm
Copy link
Contributor

@btm btm commented Nov 18, 2014

We don't always have true.exe / false.exe on Windows, especially
if we don't have the embedded bin directory from the omnibus package
in our path. This patch uses powershell + exit to simulate the same thing.

Fixes a number of failing tests. /cc @jdmundrawala

@jaym
Copy link
Contributor

jaym commented Nov 18, 2014

👍

@btm
Copy link
Contributor Author

btm commented Nov 18, 2014

@opscode/client-engineers ?

@danielsdeleo
Copy link
Contributor

Do we really need powershell to have a command that exits 0 or 1 on windows?

@btm
Copy link
Contributor Author

btm commented Nov 19, 2014

We could do the same thing with cmd.exe, which is probably a bit more lightweight. We should reliably have both cmd and powershell on a system already, whereas the existing code requires us to either install a tool or include embedded\bin in the PATH (which contains a false/true) which we keep flipping around on. Wherever we stay with the PATH, it's nice if we don't need it.

@jaym
Copy link
Contributor

jaym commented Nov 19, 2014

@btm does can we use ruby?
ruby -e exit 0 or ruby -e exit 1?

@tyler-ball
Copy link
Contributor

@jdmundrawala ruby -e exit 1 didn't work for me in IRB, but ruby -e abort did.

@danielsdeleo
Copy link
Contributor

@tyler-ball it would have to be ruby -e 'exit 1' with the quotes.

@tyler-ball
Copy link
Contributor

@danielsdeleo 👍 yup, that worked

@btm
Copy link
Contributor Author

btm commented Nov 19, 2014

Ruby was surprisingly fast. I expected it to suck on windows. It's 2-3 times faster than loading powershell:

$ time ruby -e 'exit 1'

real    0m0.071s
user    0m0.000s
sys     0m0.015s

$ time powershell 'exit 1'

real    0m0.253s
user    0m0.015s
sys     0m0.000s

@btm
Copy link
Contributor Author

btm commented Nov 19, 2014

Although cmd.exe appears to be slightly faster (once I got the right quotes)...

$ time cmd.exe /c "exit 50"

real    0m0.026s
user    0m0.015s
sys     0m0.000s

@jaym
Copy link
Contributor

jaym commented Nov 19, 2014

I think the benefit of using ruby is that we only have to maintain 1 code
path.

On Wed, Nov 19, 2014 at 8:55 AM, Bryan McLellan notifications@github.com
wrote:

Although cmd.exe appears to be slightly faster (once I got the right
quotes)...

$ time cmd.exe /c "exit 50"

real 0m0.026s
user 0m0.015s
sys 0m0.000s


Reply to this email directly or view it on GitHub
#240 (comment).

@danielsdeleo
Copy link
Contributor

If exit 0 and exit 1 work correctly on windows, then we can use that with no if statements.

We don't always have true.exe / false.exe on Windows, especially
if we don't have the embedded bin directory from the omnibus package
in our path.
@jaym
Copy link
Contributor

jaym commented Nov 20, 2014

:shipit:

@danielsdeleo
Copy link
Contributor

👍

btm added a commit that referenced this pull request Nov 20, 2014
Add support for a Windows environment without true/false
@btm btm merged commit 5003ca0 into master Nov 20, 2014
@btm btm deleted the btm/powershell_true_false branch November 20, 2014 18:29
@chef-boneyard chef-boneyard locked and limited conversation to collaborators Feb 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

5 participants