Commit 309b626e authored by mercury233's avatar mercury233

catch stdout undefined

parent ad1f15a5
...@@ -242,6 +242,7 @@ class Room ...@@ -242,6 +242,7 @@ class Room
param = [0, @hostinfo.lflist, @hostinfo.rule, @hostinfo.mode, (if @hostinfo.enable_priority then 'T' else 'F'), (if @hostinfo.no_check_deck then 'T' else 'F'), (if @hostinfo.no_shuffle_deck then 'T' else 'F'), @hostinfo.start_lp, @hostinfo.start_hand, @hostinfo.draw_count, @hostinfo.time_limit] param = [0, @hostinfo.lflist, @hostinfo.rule, @hostinfo.mode, (if @hostinfo.enable_priority then 'T' else 'F'), (if @hostinfo.no_check_deck then 'T' else 'F'), (if @hostinfo.no_shuffle_deck then 'T' else 'F'), @hostinfo.start_lp, @hostinfo.start_hand, @hostinfo.draw_count, @hostinfo.time_limit]
try
@process = spawn './ygopro', param, cwd: 'ygocore' @process = spawn './ygopro', param, cwd: 'ygocore'
@process.on 'exit', (code)=> @process.on 'exit', (code)=>
@disconnector = 'server' unless @disconnector @disconnector = 'server' unless @disconnector
...@@ -259,6 +260,8 @@ class Room ...@@ -259,6 +260,8 @@ class Room
return return
return return
return return
catch
@error = "建立房间失败,请重试"
delete: -> delete: ->
#积分 #积分
return if @deleted return if @deleted
......
...@@ -291,6 +291,7 @@ ...@@ -291,6 +291,7 @@
} }
} }
param = [0, this.hostinfo.lflist, this.hostinfo.rule, this.hostinfo.mode, (this.hostinfo.enable_priority ? 'T' : 'F'), (this.hostinfo.no_check_deck ? 'T' : 'F'), (this.hostinfo.no_shuffle_deck ? 'T' : 'F'), this.hostinfo.start_lp, this.hostinfo.start_hand, this.hostinfo.draw_count, this.hostinfo.time_limit]; param = [0, this.hostinfo.lflist, this.hostinfo.rule, this.hostinfo.mode, (this.hostinfo.enable_priority ? 'T' : 'F'), (this.hostinfo.no_check_deck ? 'T' : 'F'), (this.hostinfo.no_shuffle_deck ? 'T' : 'F'), this.hostinfo.start_lp, this.hostinfo.start_hand, this.hostinfo.draw_count, this.hostinfo.time_limit];
try {
this.process = spawn('./ygopro', param, { this.process = spawn('./ygopro', param, {
cwd: 'ygocore' cwd: 'ygocore'
}); });
...@@ -321,6 +322,9 @@ ...@@ -321,6 +322,9 @@
}); });
}; };
})(this)); })(this));
} catch (_error) {
this.error = "建立房间失败,请重试";
}
} }
Room.prototype["delete"] = function() { Room.prototype["delete"] = function() {
......
...@@ -284,6 +284,13 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)-> ...@@ -284,6 +284,13 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)->
code: 2 code: 2
} }
client.end() client.end()
else if client.room.error
ygopro.stoc_send_chat(client,client.room.error)
ygopro.stoc_send client, 'ERROR_MSG',{
msg: 1
code: 2
}
client.end()
else if client.room.started else if client.room.started
if settings.modules.post_start_watching if settings.modules.post_start_watching
client.is_post_watcher = true client.is_post_watcher = true
......
...@@ -292,6 +292,13 @@ ...@@ -292,6 +292,13 @@
code: 2 code: 2
}); });
client.end(); client.end();
} else if (client.room.error) {
ygopro.stoc_send_chat(client, client.room.error);
ygopro.stoc_send(client, 'ERROR_MSG', {
msg: 1,
code: 2
});
client.end();
} else if (client.room.started) { } else if (client.room.started) {
if (settings.modules.post_start_watching) { if (settings.modules.post_start_watching) {
client.is_post_watcher = true; client.is_post_watcher = true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment