JoshCheek / seeing_is_believing

Displays the results of every line of code in your file
1.3k stars 54 forks source link

Add windows support #92

Closed avdi closed 7 years ago

avdi commented 7 years ago

I'm starting to do more screencasts on the Windows side, so this is kind of a big deal for me.

JoshCheek commented 7 years ago

Oh, since you spent some time in there, I'm not sure if you found a good way to hit a given problem test, but one that's worked well for me is to add a tag to the spec, and running just that tag. eg: it("...", t:true) { ... } then I can run it with rspec -t t

I like it better than specifying the lineno b/c I don't have to pluck the line number out of a sea of text, and it keeps working even if I edit the test file in a way that moves the lines around.

It is a bit cavalier b/c it ignores bundler, but it keeps the pace quick (if you're more patient than me, then this might be a poor tradeoff). If you do hit issues from ignoring bundler, though, something like $ ruby $(rake require_paths) -S rspec -t t should work (bundler is just too expensive when working with subprocesses this extensively).

avdi commented 7 years ago

Commentary on all of the above as soon as I have time :-)

JoshCheek commented 7 years ago
avdi commented 7 years ago

I'm going to go point-by-point on these as soon as I can, but I wanted to start things off with a backgrounder: https://www.rubytapas.com/2016/12/14/ruby-code-on-windows/

avdi commented 7 years ago

I like the idea of a dynamic port a lot. I was wondering about that myself last night after I knocked off for the night.

JoshCheek commented 7 years ago

Hey, @avdi, I'm having difficulty getting the ChildProcess gem to work in both environments. If we don't call child.stop in the ensure block, it leaves orphan processes. But when we do call child.stop, windows gives me an error "The handle is invalid".

I've recreated it in isolation here and it's passing on Travis but failing on AppVeyor. Once those tests pass on both, I should be able to translate it for SiB.

Any chance you could try getting it working on Windows since you have native access to that environment? (I got the VM downloaded and running in VirtualBox, but my computer doesn't seem to be able to handle it, it quickly freezes up on me). If so, I can add you as a collaborator.

JoshCheek commented 7 years ago

I opened an issue on ChildProcess, too: https://github.com/enkessler/childprocess/issues/108

JoshCheek commented 7 years ago

Tried again and I got it cloned and ran the tests. Looks like the VM will work for me if I stay off the internet. I'll try looking at it tonight.

JoshCheek commented 7 years ago

Okay, got all the tests in the experiment passing on Windows and Unix. It's tricky, but I think I know the trick now: on Windows, you can't call stop after calling wait unless it interrupts the wait (or the "handle" will be invalid -- note that I don't know what a handle is), on Unix, you must call stop no matter what (or it will leave orphans).

KAGsundaram commented 7 years ago

For what it's worth, the blog post which @avdi references several times now has a few more reference links. https://www.rubytapas.com/2016/12/14/ruby-code-on-windows/