Open Oceanswave opened 9 years ago
I believe this is related to #41.
Making the changes in the referenced pull doesn't help any.
Seems like this never gets triggered.. this.sandbox.stdout.on('data', function(data) { _this.waitingOnHeartbeat = false; // Used to keep only one heartbeat on the wire at a time. _this.sandboxInitialized = true; });
I don't have a Windows VM up and running at the moment, the submission of a patch that gets tests running on Windows would gain my eternal gratitude :)
I'm finally getting to this. Windows doesn't like Unix sockets. @Oceanswave, I passed a free tcp port into the Sandcastle ops for "socket" and got it to work.
@jsas that's awesome that a tcp connection did the trick, I wonder if we should make this the default approach; about to respond to your email.
@jsas , How do I open tcp ports in Windows?
@shai067, @yoavapi adding you to this long-standing thread on Windows support.
Curious if anyone has had a chance to dig into this further?
Sorry folks, I stopped working with sandcastle a long time ago and also moved to osx.
@jsas I can understand why... It works beautifully on OSX / Linux
In my team people did this to src/metadata/constraints/expressions.js:
import os from 'os';
import { Pool, SandCastle } from 'sandcastle';
function createPool() {
/*
* Horrendous hack to get sandcastle working on windows. This should only be important for running tests
* locally on a windows machine - Lambda always runs on Linux so this code should never be executed in production.
* SandCastle unfortunately assumes it can communicate with child processes via local sockets with names like
* '/tmp/sandcastle_xx.sock' where xx is the instance number. But windows insists on names like '\\.\pipe\...'.
* There's no way of configuring this in options to Pool creation so instead we hack the SandCastle prototype
* to wrap the 'socket' property and transform it to a windows friendly format.
*/
if (os.platform() === 'win32') {
const socketPattern = /_(\d+)\./;
console.log('Hacking socket property for Windows');
Object.defineProperty(SandCastle.prototype, 'socket', {
get: function () { // eslint-disable-line object-shorthand,func-names
return this.realSocket;
},
set: function (value) { // eslint-disable-line object-shorthand,func-names
let newValue = value;
const found = value && value.match(socketPattern);
if (found) {
newValue = `\\\\.\\pipe\\sandcastle${found[1]}`;
}
this.realSocket = newValue;
}
});
}
return new Pool({ numberOfInstances: 3 }, { timeout: 6000 });
}
const sandcastle = createPool();
@marstein - Thanks! we will give it a go.
I added a pull request that attempts to fix things for Windows - #71
Works ok on my Windows 7 machine and on some co-workers' Macs. If anyone else wants to try it and make sure it runs ok (pull down the branch then run "npm install" and "npm run test") then feel free.
Unfortunately "npm install" can run into problems installing node-gyp on Windows. node-gyp generally seems somewhat problematic on Windows, depending on exactly what you've got installed. I got it working after Googling around a while, but another of my co-workers just tried "npm install" and got an entirely different error on their Windows box...
Unfortunately, I'm seeing that seeing that SandCastle doesn't seem to execute scripts under windows.
results in a timeout
When using the Pool nothing seems to happen... no timeout, nothing.