Skip to content

Commit 1b6fd3b

Browse files
eucliosuan
authored andcommitted
add windows support
1 parent db29448 commit 1b6fd3b

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

instant-markdown-d

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ var hljs = require('highlight.js');
66
var server = require('http').createServer(httpHandler),
77
exec = require('child_process').exec,
88
io = require('socket.io').listen(server),
9+
os = require('os'),
910
send = require('send');
1011

1112
// WARNING: By setting this environment variable, anyone on your network may
@@ -141,11 +142,12 @@ io.sockets.on('connection', function(sock){
141142

142143

143144
function onListening() {
144-
if (process.platform.toLowerCase().indexOf('darwin') >= 0){
145-
exec('open -g http://localhost:8090');
146-
}
147-
else { // assume unix/linux
148-
exec('xdg-open http://localhost:8090');
145+
if (os.platform() === 'win32') {
146+
exec('start /b http://localhost:8090', function(error, stdout, stderr){});
147+
} else if (os.platform() === 'darwin') {
148+
exec('open -g http://localhost:8090', function(error, stdout, stderr){});
149+
} else { // assume unix/linux
150+
exec('xdg-open http://localhost:8090', function(error, stdout, stderr){});
149151
}
150152
readAllInput(process.stdin, function(body) {
151153
writeMarkdown(body);

0 commit comments

Comments
 (0)