浏览代码

**Fix Mac close server failed.

zhuzhuyule 7 年之前
父节点
当前提交
2965ebefed
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      app/tool/hexo-shell.js

+ 2 - 2
app/tool/hexo-shell.js

@@ -154,7 +154,7 @@ var shellServer = (function () {
                     command = 'netstat -nao | findstr ';
                     command = 'netstat -nao | findstr ';
                     break;
                     break;
                 case 'darwin':
                 case 'darwin':
-                    command = 'netstat -anp|grep ';
+                    command = 'lsof -i:';
                     break;
                     break;
                 default:
                 default:
                     command = 'netstat -anp|grep ';
                     command = 'netstat -anp|grep ';
@@ -170,7 +170,7 @@ var shellServer = (function () {
                         reg = new RegExp(util.format('TCP\\s+%s:%s\\s+\\d+.\\d+.\\d+.\\d+:\\d+\\s+LISTENING\\s+(\\d+)', ip, port), 'i');
                         reg = new RegExp(util.format('TCP\\s+%s:%s\\s+\\d+.\\d+.\\d+.\\d+:\\d+\\s+LISTENING\\s+(\\d+)', ip, port), 'i');
                         break;
                         break;
                     case 'darwin':
                     case 'darwin':
-                        reg = new RegExp(util.format('tcp\\s+\\d+\\s+\\d*\\s+%s:%s\\s+\\d+.\\d+.\\d+.\\d+:[*\\d]+\\s+LISTEN\\s+(\\d+)', ip, port), 'i');
+                        reg = new RegExp('\\w+\\s+(\\d+)\\s+', 'i');
                         break;
                         break;
                     default:
                     default:
                         reg = new RegExp(util.format('tcp\\s+\\d+\\s+\\d*\\s+%s:%s\\s+\\d+.\\d+.\\d+.\\d+:[*\\d]+\\s+LISTEN\\s+(\\d+)', ip, port), 'i');
                         reg = new RegExp(util.format('tcp\\s+\\d+\\s+\\d*\\s+%s:%s\\s+\\d+.\\d+.\\d+.\\d+:[*\\d]+\\s+LISTEN\\s+(\\d+)', ip, port), 'i');