nitdbg_client: exit if not connected (instead of getting a SIGPIPE)
authorJean Privat <jean@pryen.org>
Fri, 21 Mar 2014 13:21:35 +0000 (09:21 -0400)
committerJean Privat <jean@pryen.org>
Fri, 21 Mar 2014 13:22:42 +0000 (09:22 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>

src/nitdbg_client.nit

index 0531b05..3257c72 100644 (file)
@@ -65,7 +65,6 @@ class DebugClient
                print "[HOST ADDRESS] : "+debugger_connection.address
                print "[HOST] : "+debugger_connection.host.as(not null)
                print "[PORT] : "+debugger_connection.port.to_s
-               print "Connecting ... "+debugger_connection.connect.to_s
        end
 
        init with_port (host: String, port: Int)
@@ -133,6 +132,10 @@ else
        debug = new DebugClient("127.0.0.1", toolcontext.opt_debug_port.value)
 end
 
+var res = debug.debugger_connection.connect
+print "Connecting ... " + res.to_s
+if not res then exit 1
+
 var recv_cmd: String
 
 var written_cmd: String