This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static ev_io watcher; | |
static void stdin_cb (EV_P_ ev_io *w, int revents) { | |
puts("you can now read some data"); | |
ev_io_stop(&watcher); | |
} | |
int main() { | |
... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <unistd.h> | |
#include <fcntl.h> | |
#include <stdlib.h> | |
#include <errno.h> | |
#include <string.h> | |
void set_cloexec(int fd) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <unistd.h> | |
#include <fcntl.h> | |
#include <stdlib.h> | |
#include <errno.h> | |
#include <string.h> | |
void set_cloexec(int fd) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var spawn = require('child_process').spawn; | |
// spawn_detached(file, [args = []], [options = {}], [callback]); | |
function spawn_detached(file, args, options, callback) { | |
if (arguments.length == 2 && | |
typeof args == 'function') { | |
callback = arguments[1]; | |
args = undefined; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var capture = ""; | |
var cmd = require('child_process').spawn('cmd'); | |
process.stdin.pipe(cmd.stdin); | |
cmd.stdout.pipe(process.stdout); | |
cmd.stderr.pipe(process.stderr); | |
cmd.stdout.on('data', function(data) { | |
capture += data.toString(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is a flaky webserver that introduces random weirdness and errors. | |
// It randomly pauses and resumes. | |
// It also writes out data in random-sized bursts with random delays. | |
var clientIdCounter = 0; | |
// Generate a 128k random data buffer |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <typename T> | |
class UvHandle { | |
T handle_; | |
public: | |
T* handle() { return &handle_; } | |
protected: | |
static void OnClose(); | |
static Value* Close(uint32_t argc, Arguments& argv); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From d79af7ad612f1d9620338ebdb72f407961f0bc1f Mon Sep 17 00:00:00 2001 | |
From: Bert Belder <[email protected]> | |
Date: Mon, 12 Mar 2012 21:10:25 +0100 | |
Subject: [PATCH 1/1] Make inherited pipe handles non-inheritable to child | |
processes. | |
--- | |
src/win/pipe.c | 3 +++ | |
1 files changed, 3 insertions(+), 0 deletions(-) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require('fs'), | |
path = require('path'); | |
// Create a buffer of some size | |
var buf = new Buffer(1024); | |
buf.fill(66); | |
// This will fail | |
try { | |
fs.statSync('test/test2/file20'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 8d938b2de6ecb291713ddf6ee4f79e9e0c871b93 Mon Sep 17 00:00:00 2001 | |
From: Bert Belder <[email protected]> | |
Date: Thu, 8 Mar 2012 00:13:44 +0100 | |
Subject: [PATCH 1/1] Windows: include syscall in fs errors | |
--- | |
src/node_file.cc | 21 +++++++++++++++++---- | |
1 files changed, 17 insertions(+), 4 deletions(-) | |
diff --git a/src/node_file.cc b/src/node_file.cc |