Skip to content

Commit 26faf17

Browse files
committed
Merge branch 'windows'
closes #15
2 parents db29448 + 18e5dd7 commit 26faf17

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

instant-markdown-d

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
#!/bin/sh
2-
':' //; exec "`command -v nodejs || command -v node`" "$0"
1+
#!/usr/bin/env node
32

43
var MarkdownIt = require('markdown-it');
54
var hljs = require('highlight.js');
65
var server = require('http').createServer(httpHandler),
76
exec = require('child_process').exec,
87
io = require('socket.io').listen(server),
8+
os = require('os'),
99
send = require('send');
1010

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

142142

143143
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');
144+
if (os.platform() === 'win32') {
145+
exec('start /b http://localhost:8090', function(error, stdout, stderr){});
146+
} else if (os.platform() === 'darwin') {
147+
exec('open -g http://localhost:8090', function(error, stdout, stderr){});
148+
} else { // assume unix/linux
149+
exec('xdg-open http://localhost:8090', function(error, stdout, stderr){});
149150
}
150151
readAllInput(process.stdin, function(body) {
151152
writeMarkdown(body);

0 commit comments

Comments
 (0)