How to use the pinkie.race function in pinkie

To help you get started, we’ve selected a few pinkie examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DevExpress / testcafe-browser-provider-electron / src / node-debug.js View on Github external
async _attemptToConnect (port, host) {
        this.socket.connect(port, host);

        var connectionPromise = Promise.race([
            promisifyEvent(this.socket, 'connect'),
            promisifyEvent(this.socket, 'error')
        ]);

        return await connectionPromise
            .then(() => true)
            .catch(() => {
                this.socket.removeAllListeners('connect');
                return delay(connectionRetryDelay);
            });
    }
github DevExpress / testcafe / src / utils / kill-browser-process.js View on Github external
async function runWMIC (args) {
    const wmicProcess = spawn('wmic.exe', args, { detached: true });

    let wmicOutput  = '';

    wmicProcess.stdout.on('data', data => {
        wmicOutput += data.toString();
    });

    try {
        await Promise.race([
            promisifyEvent(wmicProcess.stdout, 'end'),
            promisifyEvent(wmicProcess, 'error')
        ]);

        return wmicOutput;
    }
    catch (e) {
        return '';
    }
}
github DevExpress / testcafe-browser-provider-electron / src / index.js View on Github external
mainPath = path.join(process.cwd(), mainPath);

        var config    = getConfig(id, mainPath);
        var ipcServer = new IPCServer(config);

        await ipcServer.start();

        var ports = await getFreePorts(2);

        startElectron(config, ports);

        var hookCode      = getHookCode(config, pageUrl);
        var debugClient   = new NodeDebug(ports[0]);
        var inspectClient = new NodeInspect(ports[1]);

        await Promise.race([
            injectHookCode(debugClient, hookCode),
            injectHookCode(inspectClient, hookCode)
        ]);

        await ipcServer.connect();

        var injectingStatus = await ipcServer.getInjectingStatus();

        if (!injectingStatus.completed) {
            await ipcServer.terminateProcess();

            ipcServer.stop();

            throw new Error(ERRORS.render(ERRORS.mainUrlWasNotLoaded, {
                mainWindowUrl: config.mainWindowUrl,
                openedUrls:    injectingStatus.openedUrls

pinkie

Itty bitty little widdle twinkie pinkie ES2015 Promise implementation

MIT
Latest version published 9 years ago

Package Health Score

67 / 100
Full package analysis